-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deadlock on multithreaded usage due to UnlockSession always being called with callerHasLock=False #1888
Comments
Oh boy. How do you plan to work around this in the short term? I'm not sure when we can have a fix in place and released. |
@toesus Impressive analysis. From the C Documentation for niScope_UnlockSession:
It seems the callerHasLock pointer should only be used if its first passed to niScope_LockSession, which isn't what's happening. |
For the short term I simply went back to 1.4.1 (or 1.4.2 would be fine too I guess) I just wanted to report the issue after having spent some time debugging because it seems quite critical. Regarding the callerHasLock parameter, I also found the C library documentation confusing at first. The "convenience" they talk about seems to be for C programmers who do not care to remember how often they called lock() from the same thread? From the Python side of things it seems certainly better to encourage people to use the context manager which guarantees the matching lock/unlocks. So I would not even bother to expose the callerHasLock parameter in the python API, and simply always pass None / NULL. |
Hello, |
Also tracked by internal NI bug 2305832 |
Description of issue
I encountered a deadlock situation when using niscope from multiple threads. Starting with version 1.4.3, the Session unlock has no effect and leads to other threads hanging forever waiting for the lock.
This is due to the use of a local variable caller_has_lock_ctype which always has the default value False.
nimi-python/generated/niscope/niscope/_library_interpreter.py
Line 642 in 28f446e
System report
python -c "import niscope; niscope.print_diagnostic_information()"
output (replaceniscope
with appropriate package name)Steps to reproduce issue
This script runs two threads sequentially. The first thread is started and does a lock/unlock.
The second thread then immediately hangs when trying to do the lock().
Output:
The text was updated successfully, but these errors were encountered: