Issue 579116: pthread_exit missing in thread_pthread.h (original) (raw)

I'm using the Python 2.2.1 interpreter for scripting language in a larger program. When I used the threading module to create new threads, my main program did not exit anymore, but hang, because one python thread always remained. It got much better when I inserted a call to pthread_exit into do_PyThread_exit_thread (thread_pthread.h).

Patchfile is attached.

Logged In: YES user_id=902722

I'm using Python 2.2.1 (Unix) in a daemon process that starts child threads to handle specific events. I have noticed that occasionally (not all the time) child thread "stays" (in a SLEEPING) status after thread exits. When this happens, that thread never exits until entire process is stopped.

I have log files that have output coming from threading module (I have set threading._VERBOSE to 1) that show each thread's start and termination events. In addition, I use Queue module for inter-thread communication (when thread starts execution, it posts "START" message, and when it is about to exit its run() method, it posts "END" event).

So, from these logs and from output of "ps -fp - o 'user,pid,ppid,pgid,time,stime,lwp,s'" I can see that some threads exit (which is indicated by _VERBOSE output and a message in a Queue), but still stay (in a SLEEPING state) in the process.

Does this behavior have something to do with the problem described in this report, or is it something different?

Is there patch (full instalation package) that fixes this problem (without me having to update source code and recompile the executable)?

Logged In: YES user_id=752496

Please, could you verify if this problem persists in Python 2.3.4 or 2.4?

If yes, in which version? Can you provide a test case?

If the problem is solved, from which version?

Note that if you fail to answer in one month, I'll close this bug as "Won't fix".

Thank you!

. Facundo