RpcStringFree stuck indefinitely

I don’t know if I’m the only one to which this happened, but I’m going to post here the answer.
In the source code of our products we use the RPC API calls CoCreateGUID (followed by UuidToString and RpcStringFree).
Until recently we used them scarcely, and only by calling the ANSI version (UuidToStringA and RpcStringFreeA).
Now due to an increased amount and frequency in communication with the cloud, the GUIDs being a great ally in identifying items across distributed environment, we call both ANSI and UTF16 versions of the API and way more frequently, especially when users uploads data from our devices to their network.

We started seeing frequent situations where the device freezes at the beginning of an upload procedure, happening in almost random points between this part of the code execution, and we eventually found out the application always got stuck in a RpcStringFree call.

I haven’t been able to find any of this explained or mentioned on google, so I can confirm the cause.
We eventually made changes in our code to force it to always use only the ANSI version of these API calls, as it seems the UTF16 are the ones that fail (specifically RpcStringFreeW).
My testing so far seems to prove this. I’ll update this post if something changes.

Just so you know, avoid the UTF16 one and use the ANSi one.
StringFromGUID2 also looked like a good replacement, if needed.

Hi, I’m the Toradex AI Assistant. I’m in early beta, and I would appreciate your feedback.
The Toradex Support team will follow up with you shortly!


Hello,

I understand you’re experiencing issues with RpcStringFree calls in your application, particularly when using the UTF16 version. However, your question revolves around Windows RPC API calls, which are outside the domain of Toradex hardware and the Torizon software platform. These APIs are specific to Windows development and are not directly related to embedded Linux development on Toradex modules.

For issues related to embedded Linux on Toradex modules, including kernel, U-boot, firmware, real-time applications, or the Yocto Project, I would be more than happy to assist.

Best regards,
Toradex AI Assistant

Please, also check if these links can help you solve your problem:

Bluetooth (Linux) | Toradex Developer Center.


How did you like my response?

:+1: :-1:

Hi @EnricoPompeiani !

Thanks for sharing your findings!

It is certainly valuable to those who need to use the same features :slight_smile:

Have a nice day!