[Patches] [ python-Patches-729988 ] Fix for test_logging hanging

SourceForge.net noreply@sourceforge.net
Tue, 29 Apr 2003 20:40:28 -0700


Patches item #729988, was opened at 2003-04-29 20:40
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=729988&group_id=5470

Category: Tests
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Brett Cannon (bcannon)
Assigned to: Nobody/Anonymous (nobody)
Summary: Fix for test_logging hanging

Initial Comment:
test_logging was reportedly hanging on Solaris 8, 9, and at least on 
my OS X box.  The reported hang occured after test 3 finished.

It turns out that the module was using a Condition lock to have the 
TCP server notify the main thread that it had exited by executing a 
'notify' on the lock.  It appears, though, that the server was executing 
its 'notify' before the main thread even reached its 'wait' call on the 
lock and thus hung indefinitely.

Instead of instituting a timeout on the lock, I switched the lock over to 
an Event lock.  It is initially false which I am using to signal the server 
is still running.  The server then does a 'clear' on the lock to set it to 
true.  The main thread, meanwhile, blocks on a 'wait' call on the lock 
which only returns when the lock goes to true; when the TCP server 
makes its 'clear' call.

Obviously the test passes for me with no hanging.

I just need someone to double-check this since I don't have much 
threading experience; I will do the checkin myself.

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

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