[solved] PyThread_acquire_lock freezes at pthread_cond_wait although lock not occupied
ghillie at suse.de
Fri Feb 28 14:39:51 CET 2003
JFYI: I once reported a problem where one of my Python threads freezes at
pthread_cond_wait in GNU/Linux although the Python lock is not occupied:
I've found the reason now: it was my fault: I created multiple threads as
root and called os.setuid() in ONE thread only.
Now this thread has another UID than the others which isn't allowed in
This leads to pthread_cond_signal not working because it uses kill()
internally to weak up the other thread. But as a non-privileged thread
can't kill() a root-thread, this failed. Unfortunately, there's no error
checking for this case done in pthreads so it just silently looses the
Just removing os.setuid() did the trick.
You're only allowed to setuid() a whole process including all threads...
Learned something the hard way :-}
More information about the Python-list