develooper Front page | perl.perl5.porters | Postings from April 2007

Re: [perl #41574] cond_wait hang ups under MSWin32

Thread Previous | Thread Next
From:
demerphq
Date:
April 9, 2007 08:54
Subject:
Re: [perl #41574] cond_wait hang ups under MSWin32
Message ID:
9b18b3110704090854q6e621ac4gf60042dfb70c6883@mail.gmail.com
On 2/22/07, Jerry D. Hedden <jdhedden@yahoo.com> wrote:
> Jerry D. Hedden wrote:
> > Attached is a slightly better version of the
> > 'hang up' script.  It uses cond_timedwait, but
> > shows the same symptom.
> >
> > Note:  The script doesn't hang every time, but
> > just run it a few times and it will.  Also,
> > at what point it hangs is variable.
>
> Steve Hay wrote:
> > I've run the script about 20 times or more and haven't
> > seen it hang at all yet. Twice I got a load of messages
> > like this:
> >
> > 4 FAILED - timed out - cond_broadcast not received
> > 5 FAILED - timed out
> > 6 FAILED - timed out
> > 7 FAILED - timed out
> > 8 FAILED - timed out
> > 9 FAILED - timed out
> > ...
> >
> > but the program still exited without hanging.
>
> Oh, stupid me!  I should have changed my terminology.  The
> original script will hang - forcing you to terminate it with
> ^C.  The 'new' script doesn't hang because of the timeout,
> but that it still shows that the cond_broadcast is being
> missed.  Sorry for the confusion.

Can we not at least change the cond.t test so it uses something more
like your bug.pl?

At least then smoke wouldnt hang. Which would be a good thing in of itself.

> > My overnight smokes still hang every night, though (maint
> > as well as blead now that the latest threads changes have
> > been integrated).
>
> Yes, this bug report directly relates to this.

Im trying to investigate this. I had a look at the MSDN documentation
for WaitForSingleObject() and it does mention issues with deadlocking,
however when i recoded things to use MsgWaitForMultipleObjects as
suggested I saw no change in behaviour.

When i attach the VC debugger to the hung process i see

"The process appears to deadlocked (or is not running any user-mode
code). All threads have been stopped."

With the following stack for the main thread:

 	NTDLL.DLL!77f88f13() 	
 	KERNEL32.DLL!7c57b3e9() 	
>	perl59.dll!Perl_pp_entersub(interpreter * my_perl=0x01a423ec)  Line
2834 + 0x10	C
 	perl59.dll!Perl_runops_debug(interpreter * my_perl=0x01a423ec)  Line
1921 + 0xd	C
 	perl59.dll!S_run_body(interpreter * my_perl=0x01a423ec, long
oldscope=1)  Line 2431 + 0xd	C
 	perl59.dll!perl_run(interpreter * my_perl=0x01a423ec)  Line 2349 + 0xd	C
 	perl59.dll!RunPerl(int argc=2, char * * argv=0x015d4df0, char * *
env=0x015d28c8)  Line 266 + 0x9	C++
 	perl.exe!main(int argc=2, char * * argv=0x015d4df0, char * *
env=0x015d33c0)  Line 23 + 0x12	C
 	perl.exe!mainCRTStartup()  Line 400 + 0xe	C
 	KERNEL32.DLL!7c5989a5() 	

The relevent code is:

Code from pp_hot.c Line 2832:
	/* Do we need to open block here? XXXX */
	if (CvXSUB(cv)) /* XXX this is supposed to be true */
	    (void)(*CvXSUB(cv))(aTHX_ cv);

The micosoft article is here: http://support.microsoft.com/kb/175332

Cheers,
Yves

-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About