in reply to Re^3: Perl threads test intermittently hangs on Windows
in thread Perl threads test intermittently hangs on Windows

It's not clear to me what your debugger trace output is showing?

It's showing the stack trace of all threads at the time of the hang. I started by running the program outside the debugger. It then hung as follows:

i=365:--- parent 3980: continue kid=1 3980 before require parent 3980: continue parent 3980: waiting for join kid=2 3980 before require kid=1 3980 after require parent 3980: thread exited parent 3980: waiting for join kid=2 3980 after require parent 3980: thread exited i=366:--- parent 3980: continue kid=1 3980 before require parent 3980: continue parent 3980: waiting for join kid=2 3980 before require

Using the sysinternals pslist command in another window showed all threads waiting.

pslist -d perl perl 3980: Tid Pri Cswtch State User Time Kernel Time Elap +sed Time 6108 8 10366 Wait:UserReq 0:00:20.296 0:00:00.375 0:0 +7:47.367 3856 8 304 Wait:UserReq 0:00:00.062 0:00:00.062 0:0 +5:40.338 2784 9 282 Wait:Executive 0:00:00.062 0:00:00.046 0:0 +5:40.307

I then right clicked on the hung process in Windows Task Manager then clicked Debug which invoked WinDbg and then issued the ~* kv command to show the stack trace of all threads. After doing that, pslist output changed as follows:

pslist -d perl perl 3980: Tid Pri Cswtch State User Time Kernel Time Elap +sed Time 6108 10 10380 Wait:Suspended 0:00:20.296 0:00:00.375 0:1 +1:41.922 3856 10 316 Wait:Suspended 0:00:00.062 0:00:00.062 0:0 +9:34.893 2784 9 290 Wait:Suspended 0:00:00.062 0:00:00.046 0:0 +9:34.862 5480 10 14 Wait:Executive 0:00:00.000 0:00:00.000 0:0 +1:08.299

Replies are listed 'Best First'.
Re^5: Perl threads test intermittently hangs on Windows
by BrowserUk (Patriarch) on Jun 04, 2004 at 01:44 UTC

    I just noticed this

    If I put a little debug tracing in my Perl C sources, ...

    This implies that you are compiling the sources yourself (with modification)?

    If so, have you seen the hang with a binary distribution of AS 809?

    Given that at least two other running AS 809 on XP aren't able to reproduce the problem, the obvious (though probably annoying, sorry!), conclusion is that it's something you are changing that is causing it.

    That said, debugging my binary install of as 809, I cannot see any path from Perl_op_free() to S_cop_free() as shown on your trace.

    0331fe08 28016b83 01d58014 0197308c 01d58014 perl58!S_cop_free+0x33 (F +PO: [2,0,3]) (CONV: cdecl) [..\op.c @ 529] 0331fe20 28016b55 01d58014 0197308c 01d58014 perl58!Perl_op_free+0xb8 +(FPO: [2,0,3]) (CONV: cdecl) [..\op.c @ 360]

    which tends to suggest that your build is quite different to mine. Perhaps you are building with debug or without some of the patches AS applied? Here's my perl -V output, maybe it will allow you to see something that could explain the differnce between your's and mine.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
      This implies that you are compiling the sources yourself (with modification)? If so, have you seen the hang with a binary distribution of AS 809?

      Yes, I get the hang both with the AS 809 binary distribution and with an out-of-the-box release source code build of perl-5.8.4. I found I could not get reliable stack traces from the AS 809 binary distribution after the hang. I have not tried building from AS 809 sources yet, perhaps I should -- though I trusted that any AS 809 win32 patches would have made it back into the main perl-5.8.4 source stream.

      I just did an out-of-the-box source code install of AS 809. It hung on i=11 this time. Full details follow.

      i=10:--- parent 8384: continue kid=1 8384 before require parent 8384: continue parent 8384: waiting for join kid=2 8384 before require kid=1 8384 after require parent 8384: thread exited parent 8384: waiting for join kid=2 8384 after require parent 8384: thread exited i=11:--- parent 8384: continue kid=1 8384 before require parent 8384: continue parent 8384: waiting for join kid=2 8384 before require perl 8384: Tid Pri Cswtch State User Time Kernel Time Elap +sed Time 10680 8 324 Wait:UserReq 0:00:00.531 0:00:00.031 0: +01:07.452 9440 9 71 Wait:UserReq 0:00:00.031 0:00:00.015 0:0 +1:05.921 9556 8 58 Wait:Executive 0:00:00.015 0:00:00.000 0:0 +1:05.889 Microsoft (R) Windows Debugger Version 6.3.0005.1 Copyright (c) Microsoft Corporation. All rights reserved. *** wait with pending attach Symbol search path is: srv*C:\webmssymbols*http://msdl.microsoft.com/d +ownload/symbols Executable search path is: ModLoad: 00400000 0040a000 C:\aperl\bin\perl.exe ModLoad: 77f50000 77ff7000 C:\WINDOWS\System32\ntdll.dll ModLoad: 77e60000 77f46000 C:\WINDOWS\system32\kernel32.dll ModLoad: 77c10000 77c63000 C:\WINDOWS\system32\MSVCRT.dll ModLoad: 28000000 280c5000 C:\aperl\bin\perl58.dll ModLoad: 77d40000 77dcc000 C:\WINDOWS\system32\USER32.dll ModLoad: 77c70000 77cb0000 C:\WINDOWS\system32\GDI32.dll ModLoad: 77dd0000 77e5d000 C:\WINDOWS\system32\ADVAPI32.dll ModLoad: 78000000 78086000 C:\WINDOWS\system32\RPCRT4.dll ModLoad: 10000000 10006000 C:\aperl\lib\auto\threads\threads.dll ModLoad: 00330000 00335000 C:\aperl\lib\auto\Cwd\Cwd.dll ModLoad: 00340000 00347000 C:\aperl\lib\auto\List\Util\Util.dll (20c0.29e4): Break instruction exception - code 80000003 (first chance +) eax=7ffdf000 ebx=00000001 ecx=00000002 edx=00000003 esi=00000004 edi=0 +0000005 eip=77f75a58 esp=0037ffcc ebp=0037fff4 iopl=0 nv up ei pl zr n +a po nc cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=0 +0000246 ntdll!DbgBreakPoint: 77f75a58 cc int 3 0:003> ~* kv 0 Id: 20c0.29b8 Suspend: 1 Teb: 7ffde000 Unfrozen ChildEBP RetAddr Args to Child 0140fc94 77f5c534 77e7a62d 00000750 00000000 SharedUserData!SystemCall +Stub+0x4 (FPO: [0,0,0]) 0140fc98 77e7a62d 00000750 00000000 00000000 ntdll!NtWaitForSingleObje +ct+0xc (FPO: [3,0,0]) 0140fcfc 77e7ac21 00000750 ffffffff 00000000 kernel32!WaitForSingleObj +ectEx+0xa8 (FPO: [Non-Fpo]) *** WARNING: Unable to verify checksum for C:\aperl\lib\auto\threads\t +hreads.dll 0140fd0c 10001a0c 00000750 ffffffff 00000004 kernel32!WaitForSingleObj +ect+0xf (FPO: [2,0,0]) 0140fd38 10001fbd 00224864 01a174cc 00224864 threads!Perl_ithread_join ++0x71 (CONV: cdecl) [threads.xs @ 572] *** WARNING: Unable to verify checksum for C:\aperl\bin\perl58.dll 0140fd5c 28040680 00226ee8 01891dc8 00000001 threads!XS_threads_join+0 +x7a (CONV: cdecl) [threads.xs @ 688] 0140fd9c 2805eda4 01224864 00224864 28024bf3 perl58!Perl_pp_entersub+0 +x3ca (CONV: cdecl) [..\pp_hot.c @ 2843] 0140fda8 28024bf3 00224864 00224864 7ffdf000 perl58!Perl_runops_standa +rd+0xc (FPO: [1,0,1]) (CONV: cdecl) [..\run.c @ 23] 0140fdb8 28024aaa 00224864 00000001 00000000 perl58!S_run_body+0xdd (F +PO: [2,0,2]) (CONV: cdecl) [..\perl.c @ 1857] 0140fe24 2808975e 00224864 77f944a8 00000007 perl58!perl_run+0x17e (CO +NV: cdecl) [..\perl.c @ 1776] *** WARNING: Unable to verify checksum for C:\aperl\bin\perl.exe 0140ff3c 00401012 00000002 00222cc0 00223160 perl58!RunPerl+0x86 (CONV +: cdecl) [perllib.c @ 202] 0140ff4c 004010f9 00000002 00222cc0 00223160 perl!main+0x12 (FPO: [3,0 +,0]) (CONV: cdecl) [perlmain.c @ 17] 0140ffc0 77e814c7 77f944a8 00000007 7ffdf000 perl!mainCRTStartup+0xe3 0140fff0 00000000 00401016 00000000 00000000 kernel32!BaseProcessStart ++0x23 (FPO: [Non-Fpo]) 1 Id: 20c0.24e0 Suspend: 1 Teb: 7ffdd000 Unfrozen ChildEBP RetAddr Args to Child 0331fc9c 77f5c534 77f69f68 000007ac 00000000 SharedUserData!SystemCall +Stub+0x4 (FPO: [0,0,0]) 0331fca0 77f69f68 000007ac 00000000 00000000 ntdll!NtWaitForSingleObje +ct+0xc (FPO: [3,0,0]) 0331fd28 77f5b2e6 00222d44 28086a09 00222d44 ntdll!RtlpWaitForCritical +Section+0x125 (FPO: [Non-Fpo]) 0331fd30 28086a09 00222d44 28087772 03cb6d70 ntdll!RtlEnterCriticalSec +tion+0x46 (FPO: [1,0,0]) 0331fd38 28087772 03cb6d70 2808775f 03c6afd4 perl58!VMem::GetLock+0xa +(FPO: [0,0,0]) (CONV: thiscall) [vmem.h @ 229] 0331fd40 2808775f 03c6afd4 28016c80 0182d8f0 perl58!CPerlHost::FreeSha +red+0x12 (FPO: [1,0,1]) (CONV: thiscall) [perlhost.h @ 96] 0331fd48 28016c80 0182d8f0 03c6afd4 00000000 perl58!PerlMemSharedFree+ +0x10 (FPO: [2,0,0]) (CONV: cdecl) [perlhost.h @ 356] 0331fd64 28016a2f 0198327c 03cb6d70 0198327c perl58!S_cop_free+0x26 (F +PO: [2,0,3]) (CONV: cdecl) [..\op.c @ 466] 0331fd7c 28016a01 0198327c 03cb6d70 0198327c perl58!Perl_op_free+0xb8 +(FPO: [2,0,3]) (CONV: cdecl) [..\op.c @ 322] 0331fd94 28016a01 0198327c 03c67708 0198327c perl58!Perl_op_free+0x8a +(FPO: [2,0,3]) (CONV: cdecl) [..\op.c @ 312] 0331fdac 28016a01 0198327c 03cb7c60 0198327c perl58!Perl_op_free+0x8a +(FPO: [2,0,3]) (CONV: cdecl) [..\op.c @ 312] 0331fdc4 28016a01 0198327c 03cb7c40 0198327c perl58!Perl_op_free+0x8a +(FPO: [2,0,3]) (CONV: cdecl) [..\op.c @ 312] 0331fddc 28016a01 0198327c 03cb7c00 0198327c perl58!Perl_op_free+0x8a +(FPO: [2,0,3]) (CONV: cdecl) [..\op.c @ 312] 0331fdf4 28016a01 0198327c 03cb7be0 0198327c perl58!Perl_op_free+0x8a +(FPO: [2,0,3]) (CONV: cdecl) [..\op.c @ 312] 0331fe0c 28016a01 0198327c 03cb7b80 0198327c perl58!Perl_op_free+0x8a +(FPO: [2,0,3]) (CONV: cdecl) [..\op.c @ 312] 0331fe24 28016a01 0198327c 03cb7b0c 0198327c perl58!Perl_op_free+0x8a +(FPO: [2,0,3]) (CONV: cdecl) [..\op.c @ 312] 0331fe3c 28016a01 0198327c 019b4f8c 01ba82cc perl58!Perl_op_free+0x8a +(FPO: [2,0,3]) (CONV: cdecl) [..\op.c @ 312] 0331fe54 2806023a 0198327c 03cb7a2c 01a23edc perl58!Perl_op_free+0x8a +(FPO: [2,0,3]) (CONV: cdecl) [..\op.c @ 312] 0331fe74 2805efbf 00000500 00000091 2803a8c0 perl58!Perl_leave_scope+0 +x2c1 (CONV: cdecl) [..\scope.c @ 885] 0331fe80 2803a8c0 0198327c 00000000 0198327c perl58!Perl_pop_scope+0x1 +c (FPO: [1,0,0]) (CONV: cdecl) [..\scope.c @ 137] 2 Id: 20c0.2554 Suspend: 1 Teb: 7ffdc000 Unfrozen ChildEBP RetAddr Args to Child 04f1fd04 77f5c534 77f69f68 000007ac 00000000 SharedUserData!SystemCall +Stub+0x4 (FPO: [0,0,0]) 04f1fd08 77f69f68 000007ac 00000000 00000000 ntdll!NtWaitForSingleObje +ct+0xc (FPO: [3,0,0]) 04f1fd90 77f5b2e6 00222d44 28086a09 00222d44 ntdll!RtlpWaitForCritical +Section+0x125 (FPO: [Non-Fpo]) 04f1fd98 28086a09 00222d44 280876e2 03ca8c2c ntdll!RtlEnterCriticalSec +tion+0x46 (FPO: [1,0,0]) 04f1fda0 280876e2 03ca8c2c 0190b5e8 280876d2 perl58!VMem::GetLock+0xa +(FPO: [0,0,0]) (CONV: thiscall) [vmem.h @ 229] 04f1fdac 280876d2 0000001a 28083505 0190b5e8 perl58!CPerlHost::MallocS +hared+0xf (FPO: [1,0,2]) (CONV: thiscall) [perlhost.h @ 81] 04f1fdb4 28083505 0190b5e8 0000001a 03cb4d5c perl58!PerlMemSharedMallo +c+0x10 (FPO: [2,0,0]) (CONV: cdecl) [perlhost.h @ 346] 04f1fdc8 2801b2d5 03c2203c 03cb4d5c 01b207bc perl58!Perl_savesharedpv+ +0x21 (FPO: [2,0,1]) (CONV: cdecl) [..\util.c @ 806] 04f1fde0 28029079 03c2203c 00000000 00000000 perl58!Perl_newSTATEOP+0x +13a (FPO: [4,0,3]) (CONV: cdecl) [..\op.c @ 3375] 04f1fe28 28039147 018337e0 00000000 03c2203c perl58!Perl_yyparse+0x32d + (FPO: [EBP 0x04f1fe40] [1,9,4]) (CONV: cdecl) [perly.y @ 180] 04f1fe40 2803a079 018c279c 00000000 00000000 perl58!S_doeval+0x1cf (CO +NV: cdecl) [..\pp_ctl.c @ 2798] 04f1feb4 2805eda4 01b08ddc 03c2203c 280252e3 perl58!Perl_pp_require+0x +b97 (CONV: cdecl) [..\pp_ctl.c @ 3295] 04f1fec0 280252e3 03c2203c 03c2203c 2802518b perl58!Perl_runops_standa +rd+0xc (FPO: [1,0,1]) (CONV: cdecl) [..\run.c @ 23] 04f1fecc 2802518b 03c2203c 04f1ff54 00000000 perl58!S_call_body+0x33 ( +FPO: [3,0,1]) (CONV: cdecl) [..\perl.c @ 2221] 04f1ff88 100013e5 03c2203c 01a58540 00000004 perl58!Perl_call_sv+0x37b + (CONV: cdecl) [..\perl.c @ 2160] 04f1ffb4 77e7d33b 01b08ddc 01947800 00220278 threads!Perl_ithread_run+ +0x106 (CONV: stdcall) [threads.xs @ 297] 04f1ffec 00000000 100012df 0193e014 00000000 kernel32!BaseThreadStart+ +0x37 (FPO: [Non-Fpo]) # 3 Id: 20c0.29e4 Suspend: 1 Teb: 7ffdb000 Unfrozen ChildEBP RetAddr Args to Child 0037ffc8 77f5f31f 00000005 00000004 00000001 ntdll!DbgBreakPoint (FPO: + [0,0,0]) 0037fff4 00000000 00000000 00000000 00000000 ntdll!DbgUiRemoteBreakin+ +0x2d (FPO: [Non-Fpo]) Summary of my perl5 (revision 5 version 8 subversion 3) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef usethreads=undef use5005threads=undef useithreads=define usemultip +licity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cl', ccflags ='-nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D +_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DPERL_IMPLICI +T_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX', optimize='-MD -Zi -DNDEBUG -O1', cppflags='-DWIN32' ccversion='', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64 +', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -l +ibpath:"c:\aperl\lib\CORE" -machine:x86' libpth="C:\Program Files\Microsoft Visual Studio\VC98\lib" libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib + comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netap +i32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.li +b odbccp32.lib msvcrt.lib perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool +.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib n +etapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc3 +2.lib odbccp32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib gnulibc_version='undef' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt: +ref,icf -libpath:"c:\aperl\lib\CORE" -machine:x86' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL +_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS Locally applied patches: ActivePerl Build 809 22218 Remove the caveat about detached threads crashing on Windo +ws 22201 Avoid threads+win32 crash by freeing Perl interpreter slig +htly later 22169 Display 'out of memeory' errors using low-level I/O 22159 Upgrade to Time::Hires 1.55 22120 Make 'Configure -Dcf_by=...' work 22051 Upgrade to Time::HiRes 1.54 21540 Fix backward-compatibility issues in if.pm Built under MSWin32 Compiled at Jun 4 2004 14:29:11 @INC: C:/aperl/lib C:/aperl/site/lib .

        Weird! No matter how hard I try, I cannot reproduce the hang. I've added requires for a few big modules and a dozen small ones and it always completes for me. The only difference I can see is that you have the MS debugger installed and I don't. Whether that could explain it I'm not sure.


        Examine what is said, not who speaks.
        "Efficiency is intelligent laziness." -David Dunham
        "Think for yourself!" - Abigail