Issue with MQTT Client on CC100 Causing CODESYS Runtime Crash


I am using a CC100 controller along with the MQTT client from the IIOT_SL library in CODESYS. My program runs perfectly on a PC runtime, but on the CC100, setting the xEnable parameter of the MQTT client function block to true causes the CODESYS runtime to crash. However, if I manually set this variable while CODESYS is online, it works fine.

Has anyone encountered this issue before and could offer some assistance?

Thank you.

Hello :wink:
Which FW / CODESYS version and Device description you are using ?
Do the crash happens right away after setting xEnable to TRUE ?
Do you use encryption ?
Is this related to the Client FB or Publish FB ?
Maybe you could add a POU for implicit check to see if there is a Bound issue for instance.

Hello @quenorha ,

Thank you for your response.

We are using firmware version 26. I can confirm that the crash occurs immediately after setting xEnable to TRUE in the program. However, if I set xEnable to TRUE manually using CTRL + F7, the issue does not occur.

We are using an encrypted connection but without client-side certificates.

The issue is specifically related to the Client FB.

Regarding the POU for implicit checks, I have already implemented them, but the crash still occurs.

Any further assistance would be greatly appreciated.

Thank you.

Have you tried without encryption to see if this is related ?
Any relevant information in the log ?

1 Like

Perhaps you can also provide information on how many publish and subscribe blocks are used in conjunction with the client fb?

How are the Pub/Sub blocks processed? Possibly in a loop?

The client block processes a queue and if this gets longer and longer without the client FB being called, this could lead to a memory leak.

In addition, the library parameters for the MQTT library should be selected appropriately so that unnecessarily large variables are not used.

1 Like

Thank you for your clarifications. It turns out the problem was due to another library; I was initializing a value with a size that was too large, which worked on the PC runtime but not on the CC100.

While we are discussing this library, I noticed that the FB Client has a parameter for attaching the connection to a background process, but Codesys provides very little information in the online help. Do you know how to use this feature?

1 Like

You can create an instance of the function block “AsyncProperty” from the Net Base Sevices library and then pass it to the interface input itfAsyncProperty. In the declaration, you can initialize the Fb with the desired values of the task.


1 Like