![]() |
![]() ![]()
Experimental Physics and
| ||||||||||||||
|
Dear all, In the Node.js single-threaded environment, if I load libca.so and call ca_clear_channel() after the user callback execution of ca_array_put_callback(), sometimes a deadlock occurs. After printing logs, I found that the code blocked at Line 391 of https://github.com/epics-base/epics-base/blob/7.0/modules/ca/src/client/access.cpp
390 //
In Channel Access reference manual, the description of ca_clear_channel() includes the following info, Note: This operation blocks until any user callbacks for this channel have run to completion. If callbacks take a lock (mutex) then it is the user's responsibility to ensure that this lock is not held when ca_clear_channel() is called, otherwise a deadlock may ensue.
So my question is how to prevent the deadlock from users' side. In the following training link, the approach is to wait in ca_pend_event() for the callbacks to occur. Is there any other approach or idea besides just waiting enough time for callback to finish? https://epics.anl.gov/docs/GSWE/developtools/EPICSTraining.IntroductionToChannelAccessClients.Handouts.pdf
Thanks, Lin
| ||||||||||||||
ANJ, 24 May 2023 |
![]() · Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |