The IEC application depends on semaphores.
Requirements
You have a Linux or Windows-based runtime version >= SP20.
Troubleshooting
If you observe deadlocks or hanging of semaphores while running your IEC application or doing operations with your CODESYS runtime, then this may be caused by semaphore locks or deadlocks.
Runtime versions SP20 and higher (Linux and Windows) are able to help with a diagnostic function for semaphores. This diagnosis can help to find the semaphore or the interaction between related tasks working on the problematic semaphore.
You need to enable this feature in the configuration file:
[SysSem] SemEnterDiagnosis=1
Important
This can have a serious impact on the performance and timing of the application (and the runtime).
Use for diagnostic purposes only.
Do not use in production systems.

In this example, MainTask_1
holds a semaphore for a few milliseconds, and MainTask
tries to access this semaphore.