PCAN-Basic hanging on Uninitialize

This forum covers issues concerning multiple software products.
Post Reply
andrewjb3
Posts: 3
Joined: Fri 29. Mar 2019, 13:21

PCAN-Basic hanging on Uninitialize

Post by andrewjb3 » Fri 29. Mar 2019, 13:32

I've a PC app (C#) calling into the PCAN-Basic dll. At various points it calls CAN_Uninitialize, and this sometimes hangs. A call stack is (hopefully!) attached.

Anyone on here have access to source? It's hard to generate a self-contained small sample to reproduce this without a lot of effort, but hopefully someone might be able to see what the critical section it's hanging on is for, and suggest whether there's a bug in the dll or at my end...
Attachments
PCAN.PNG
PCAN.PNG (9.86 KiB) Viewed 1835 times

K.Wagner
Software Development
Software Development
Posts: 710
Joined: Wed 22. Sep 2010, 13:36

Re: PCAN-Basic hanging on Uninitialize

Post by K.Wagner » Fri 29. Mar 2019, 14:28

Hello,

it seems as you are calling the PCAN-Basic from within another dll (MxxxBootloader.dll). Are you using critical sections in there? Are you loading the PCAN-Basic dll when the program is terminating (at DetachDll)? There are several possibilities for such a problem, but I think this is more at your end.

Maybe this document is useful for you:
Dynamic-Link Libraries Best Practices
Best regards,
Keneth

andrewjb3
Posts: 3
Joined: Fri 29. Mar 2019, 13:21

Re: PCAN-Basic hanging on Uninitialize

Post by andrewjb3 » Thu 4. Apr 2019, 13:45

I've done a lot more checking into this. It's nothing to do with dll loading/unloading - the Initlaize then Uninitialize are being done whilst the app is running.

I've no critical sections in my own code. It's a critical section within the PCAN-Basic dll that it's using that's not releasing for some reason.

Do you have source access? What's the critical section object used for? Could there be a race or some such if there's data arriving on the bus just as I call Unitialise, or something like that?

K.Wagner
Software Development
Software Development
Posts: 710
Joined: Wed 22. Sep 2010, 13:36

Re: PCAN-Basic hanging on Uninitialize

Post by K.Wagner » Thu 4. Apr 2019, 14:12

Hello,
andrewjb3 wrote:the Initlaize then Uninitialize are being done whilst the app is running.
This is the most basic procedure users follow with PCAN-Basic. added to this, it has been used since years mainly in multithreading scenarios. It would be very extrange to have such undetected bug of this kind in the library. Please do the test with any of the sample project: Start debugging (or start the already compiled sample), connect to a channel and start reading messages. Then just click disconnect and connect several times. Please tell us if you see the same problem with it.
andrewjb3 wrote:Do you have source access? What's the critical section object used for? Could there be a race or some such if there's data arriving on the bus just as I call Unitialise, or something like that?
Please provide us with a minimalistic test project that shows the problem, and we will test it. You can send the files to support[at}peak-system.com, mentioning this post so we can know what it is about.
Best regards,
Keneth

Post Reply