[ python-Bugs-928332 ] Python interpreter stalled on _PyPclose.WaitForSingleObject

SourceForge.net noreply at sourceforge.net
Fri Apr 2 12:33:07 EST 2004


Bugs item #928332, was opened at 2004-04-02 18:00
Message generated for change (Settings changed) made by theller
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=928332&group_id=5470

Category: Windows
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Popov (evgeni_popov)
>Assigned to: Nobody/Anonymous (nobody)
Summary: Python interpreter stalled on _PyPclose.WaitForSingleObject

Initial Comment:
Windows only:

You can easily block the whole interpreter by starting a 
lengthy/blocking external process with os.popenX:

import os, time, threading

def showtime():
    while 1:
        print '.'
        time.sleep(1)
        
th1 = threading.Thread(None, showtime, None)
th1.start()
fo = os.popen('cscript waitforever.vbs', 'rt')
res = fo.close()
print 'ok'

waitforever.vbs has a single line: WScript.Sleep
(2000000000)
You will never reach print 'ok', which is the expected 
behaviour because fo.close() is waiting for the process 
to stop, something which will never happen.
The problem is that the 'showtime' thread is also 
blocked ! Indeed, when looking with the debugger, we 
can see that the main thread is blocked in the 
_PyPclose.WaitForSingleObject call, but the GIL has not 
been released before entering this wait, so any other 
Python thread are blocked too.
So I think that the GIL should be released before the 
WaitForSingleObject call. Also, something different from 
INFINITE as the second parameter may be appropriate 
(defined by the user, for eg, would be great)...


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=928332&group_id=5470



More information about the Python-bugs-list mailing list