User | Kudos |
---|---|
6 | |
5 | |
2 | |
2 | |
2 |
I ran across this issue as described in this thread:
https://forums.ni.com/t5/Actor-Framework-Discussions/MGI-Panel-Actor-hanging/td-p/3759297
If you're using named semaphores, you can come into an issue when one process wants to release its reference without the entire semaphore being released. If you have multiple processes looking at the same semaphore reference, you can end up in a situation where one process has the lock when another releases it. When the process holding the lock tries to release the lock, it finds its semaphore reference has been released, so the function returns an error. When this happens, the lock is "eaten" and is never returned to the pool.
To combat this, ideally you'd have your "Close" process wait until it obtains the lock, then close it right after. However, if it waits on a lock (so other processes finish what they're doing), then releases the lock, then clears it, you have a small window of time where another process can grab the lock before the Close process can release the reference, in which case you can't release the semaphore. There isn't currently a way to perform the Obtain lock- Release reference atomically.
A workaround is to use a new temporary reference (as I describe in that thread), but it would be nice if Release Semaphore Reference could have an input "Wait on lock(s) before releasing" input. I'm not sure how this would work with semaphores with more than 1 element... I've never used one with more than 1 resource available 🙂
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any idea that has received less than 2 kudos within 2 years after posting will be automatically declined.