Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backticks don't work in Win32 multithreaded perl #8371

Closed
p5pRT opened this issue Mar 14, 2006 · 16 comments
Closed

Backticks don't work in Win32 multithreaded perl #8371

p5pRT opened this issue Mar 14, 2006 · 16 comments

Comments

@p5pRT
Copy link

p5pRT commented Mar 14, 2006

Migrated from rt.perl.org#38723 (status was 'resolved')

Searchable as RT38723$

@p5pRT
Copy link
Author

p5pRT commented Mar 14, 2006

From krzysztofk@rocketmail.com

In short when I use fork under Win32 backticks don't
work properly.
Following program instead of printing long list of
lines like
"Process x iteration y" stops writing after just a few
iteration
and does not exit.
I looked through the code and found the problem.
Function win32_popen is not thread safe.
Recompiling perl with -DUSE_RTL_POPEN fixes the
problem.

sub run_p($)
{
  my($num) = @​_;
  print "Process $num($$) started.\n";
  for(1..20){
  `dir`;
  print "Process $num iteration $_\n";
  }
  print LOG "Process $num done.\n";
}

$|=1;
my $NFORK=6;
open LOG,">log.txt";
for(1..$NFORK){
  my $pid;
  if(($pid=fork())){
  print "Starting process $_($pid)\n";
  $num{$pid} = $_;
  }
  else{
  sleep 1;
  run_p($_);
  exit;
  }
}
for(1..$NFORK){
  my $pid= wait();
  print STDERR "Wait returned $pid ($num{$pid})\n";
}

Perl Info

Flags:
    category=core
    severity=high

Site configuration information for perl v5.8.0:

Configured by krzysztofk at Thu Dec  5 09:58:56 2002.

Summary of my perl5 (revision 5 version 8 subversion
0) 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 usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=undef
usesocks=undef
    use64bitint=undef use64bitall=undef
uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cl', ccflags ='-nologo -Gf -W3 -MD -DNDEBUG
-O2 -DWIN32 -D_CONSOLE -DNO_STRICT  
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
-DUSE_PERLIO -DPERL_MSVCRT_READFIX',
    optimize='-MD -DNDEBUG -O2',
    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='off_t', lseeksize=4
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib
-release  -libpath:"d:\perl8\lib\CORE"  -align:4096
-machine:x86'
    libpth=\lib
    libs=  oldnames.lib kernel32.lib user32.lib
gdi32.lib winspool.lib  comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib  netapi32.lib
uuid.lib wsock32.lib mpr.lib winmm.lib  version.lib
odbc32.lib 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  netapi32.lib
uuid.lib wsock32.lib mpr.lib winmm.lib  version.lib
odbc32.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 -release  -libpath:"d:\perl8\lib\CORE" 
-align:4096 -machine:x86'

Locally applied patches:
    -Ox


@INC for perl v5.8.0:
    D:/PERL8/lib
    D:/PERL8/site/lib
    .


Environment for perl v5.8.0:
    CYGWIN=tty
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=L:\Program Files\Microsoft DirectX 9.0 SDK
(June
2005)\Utilities\Bin\x86;L:\oracle\ora92\bin;L:\Program
Files\Oracle\jre\1.3.1\bin;L:\Program
Files\Oracle\jre\1.1.8\bin;L:\oracle\ora817\bin;L:\Program
Files\Oracle\jre\1.1.7\bin;L:\WINDOWS\system32;L:\WINDOWS;L:\WINDOWS\system32\WBEM;e:\vc6\bin;L:\Program
Files\ATI Technologies\ATI Control Panel;L:\Program
Files\OpenSSH\bin;L:\Program Files\Common
Files\Adobe\AGL;L:\Manu\ManuV72\config\lib;L:\Manu\ManuV72\config\scpoweb\bin;62800.1106;L:\Program
Files\Embarcadero\DBA541;L:\Program
Files\Embarcadero\June2001Shared;;C:\PROGRA~1\ATITEC~1\ATICON~1;d:\perl\bin
    PERL_BADLANG (unset)
    SHELL (unset)


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

@p5pRT
Copy link
Author

p5pRT commented May 27, 2013

From @jkeenan

On Mon Mar 13 19​:17​:18 2006, krzysztofk wrote​:

This is a bug report for perl from
krzysztofk@​rocketmail.com,
generated with the help of perlbug 1.34 running under
perl v5.8.0.

-----------------------------------------------------------------
[Please enter your report here]
In short when I use fork under Win32 backticks don't
work properly.
Following program instead of printing long list of
lines like
"Process x iteration y" stops writing after just a few
iteration
and does not exit.
I looked through the code and found the problem.
Function win32_popen is not thread safe.
Recompiling perl with -DUSE_RTL_POPEN fixes the
problem.

sub run_p($)
{
my($num) = @​_;
print "Process $num($$) started.\n";
for(1..20){
`dir`;
print "Process $num iteration $_\n";
}
print LOG "Process $num done.\n";
}

$|=1;
my $NFORK=6;
open LOG,">log.txt";
for(1..$NFORK){
my $pid;
if(($pid=fork())){
print "Starting process $_($pid)\n";
$num{$pid} = $_;
}
else{
sleep 1;
run_p($_);
exit;
}
}
for(1..$NFORK){
my $pid= wait();
print STDERR "Wait returned $pid ($num{$pid})\n";
}

Reviewing older tickets this morning, I came across this one.

Krzysztofk​: It appears that by re-compiling Perl, you found a
satisfactory work-around. Do you need further assistance with this problem?

List​: Could someone familiar with the current status of 'fork' on Win32
systems please assess the issues in this ticket?

Thank you very much.
Jim Keenan

@p5pRT
Copy link
Author

p5pRT commented May 27, 2013

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented May 27, 2013

From @bulk88

On Mon May 27 06​:06​:19 2013, jkeenan wrote​:

Reviewing older tickets this morning, I came across this one.

Krzysztofk​: It appears that by re-compiling Perl, you found a
satisfactory work-around. Do you need further assistance with this
problem?

List​: Could someone familiar with the current status of 'fork' on Win32
systems please assess the issues in this ticket?

Thank you very much.
Jim Keenan

___________________________________________________________________
C​:\Documents and Settings\Owner\Desktop>perl n11.pl
Starting process 1(-2992)
Starting process 2(-4472)
Starting process 3(-4452)
Starting process 4(-5996)
Starting process 5(-5288)
Starting process 6(-1636)
Process 1(-2992) started.
Process 3 iteration 2
Process 1 iteration 2
Process 4 iteration 1
Process 3 iteration 5
Process 4 iteration 3
Process 6 iteration 4
Process 1 iteration 7
Process 5 iteration 6
Process 4 iteration 6
Process 2 iteration 6
Process 3 iteration 10
Process 6 iteration 6
Process 3 iteration 12
Process 4 iteration 9
Process 1 iteration 11
Process 3 iteration 13
Process 1 iteration 13
Process 5 iteration 13
Process 6 iteration 9
Process 5 iteration 14
Process 1 iteration 15
Process 2 iteration 11
Process 1 iteration 16
Process 2 iteration 12
Process 5 iteration 17
Process 2 iteration 13
Process 6 iteration 12
Process 3 iteration 20
Wait returned -4452 (3)
Process 1 iteration 20
Wait returned -2992 (1)
Process 4 iteration 14
Process 5 iteration 19
Process 2 iteration 14
Wait returned -5288 (5)
Process 6 iteration 13
Process 4 iteration 15
Process 6 iteration 14
Process 4 iteration 16
Process 6 iteration 15
Process 4 iteration 17
Process 6 iteration 16
Process 4 iteration 18
Process 6 iteration 17
Process 4 iteration 19
Process 4 iteration 20
Wait returned -5996 (4)
Process 2 iteration 19
Process 6 iteration 19
Process 2 iteration 20
Process 6 iteration 20
Wait returned -1636 (6)
Wait returned -4472 (2)

C​:\Documents and Settings\Owner\Desktop>
____________________________________________________________________

All psuedo processes reached 20. Ran script 5 times, no freezes. Perl
5.19.0. Normal Win32 Perl does not use USE_RTL_POPEN, so my tests were
done WITHOUT the mod the OP made to get it to not freeze for him. I
recommend close.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented May 27, 2013

From @jkeenan

On Mon May 27 15​:11​:44 2013, bulk88 wrote​:

On Mon May 27 06​:06​:19 2013, jkeenan wrote​:

Reviewing older tickets this morning, I came across this one.

Krzysztofk​: It appears that by re-compiling Perl, you found a
satisfactory work-around. Do you need further assistance with this
problem?

List​: Could someone familiar with the current status of 'fork' on Win32
systems please assess the issues in this ticket?

Thank you very much.
Jim Keenan

___________________________________________________________________
C​:\Documents and Settings\Owner\Desktop>perl n11.pl
Starting process 1(-2992)

[snip]

Wait returned -1636 (6)
Wait returned -4472 (2)

C​:\Documents and Settings\Owner\Desktop>
____________________________________________________________________

All psuedo processes reached 20. Ran script 5 times, no freezes. Perl
5.19.0. Normal Win32 Perl does not use USE_RTL_POPEN, so my tests were
done WITHOUT the mod the OP made to get it to not freeze for him. I
recommend close.

Let's give the OP and others seven days to comment, then close. Am
taking the ticket for that purpose.

Thank you very much.
Jim Keenan

@p5pRT
Copy link
Author

p5pRT commented May 29, 2013

From krzysztofk@rocketmail.com

Thank you for running the tests.
Results looks good.
However I downloaded newest Strawberry perl ( 5.18.0.1 ) both 32 and 64 bit version and tried to run test.
Results were not good for 32 bit version​:
D​:\kk\perl\perl18>bin\perl popen.test
Starting process 1(-5492)
Starting process 2(-6948)
Starting process 3(-2248)
Starting process 4(-6436)
Starting process 5(-6188)
Starting process 6(-6908)
Process 1(-5492) started.
Process 3 iteration 5
Wait returned -2248 (3)
Wait returned -5492 (1)
Wait returned -6948 (2)
Wait returned -6436 (4)
Wait returned -6908 (6)
Process 5 iteration 20
Wait returned -6188 (5)

It did not freeze, but most of output from pseudo processes is missing.
I run it a few times with similar, but not identical results.
I run the test on Win7 64 bit.
64bit version of perl worked fine.
So it looks like the problem is still there, but it does show in all circumstances.
I run the test on the same 32bit Strawberry perl on Windows XP under VMware and it worked fine

Thank you,
 Kris Koczyjan

________________________________
From​: bulk88 via RT <perlbug-followup@​perl.org>
To​: krzysztofk@​rocketmail.com
Sent​: Monday, May 27, 2013 5​:11 PM
Subject​: [perl #38723] Backticks don't work in Win32 multithreaded perl

On Mon May 27 06​:06​:19 2013, jkeenan wrote​:

Reviewing older tickets this morning, I came across this one.

Krzysztofk​:  It appears that by re-compiling Perl, you found a
satisfactory work-around.  Do you need further assistance with this
problem?

List​: Could someone familiar with the current status of 'fork' on Win32
systems please assess the issues in this ticket?

Thank you very much.
Jim Keenan

___________________________________________________________________
C​:\Documents and Settings\Owner\Desktop>perl n11.pl
Starting process 1(-2992)
Starting process 2(-4472)
Starting process 3(-4452)
Starting process 4(-5996)
Starting process 5(-5288)
Starting process 6(-1636)
Process 1(-2992) started.
Process 3 iteration 2
Process 1 iteration 2
Process 4 iteration 1
Process 3 iteration 5
Process 4 iteration 3
Process 6 iteration 4
Process 1 iteration 7
Process 5 iteration 6
Process 4 iteration 6
Process 2 iteration 6
Process 3 iteration 10
Process 6 iteration 6
Process 3 iteration 12
Process 4 iteration 9
Process 1 iteration 11
Process 3 iteration 13
Process 1 iteration 13
Process 5 iteration 13
Process 6 iteration 9
Process 5 iteration 14
Process 1 iteration 15
Process 2 iteration 11
Process 1 iteration 16
Process 2 iteration 12
Process 5 iteration 17
Process 2 iteration 13
Process 6 iteration 12
Process 3 iteration 20
Wait returned -4452 (3)
Process 1 iteration 20
Wait returned -2992 (1)
Process 4 iteration 14
Process 5 iteration 19
Process 2 iteration 14
Wait returned -5288 (5)
Process 6 iteration 13
Process 4 iteration 15
Process 6 iteration 14
Process 4 iteration 16
Process 6 iteration 15
Process 4 iteration 17
Process 6 iteration 16
Process 4 iteration 18
Process 6 iteration 17
Process 4 iteration 19
Process 4 iteration 20
Wait returned -5996 (4)
Process 2 iteration 19
Process 6 iteration 19
Process 2 iteration 20
Process 6 iteration 20
Wait returned -1636 (6)
Wait returned -4472 (2)

C​:\Documents and Settings\Owner\Desktop>
____________________________________________________________________

All psuedo processes reached 20. Ran script 5 times, no freezes. Perl
5.19.0. Normal Win32 Perl does not use USE_RTL_POPEN, so my tests were
done WITHOUT the mod the OP made to get it to not freeze for him. I
recommend close.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented May 29, 2013

From krzysztofk@rocketmail.com

OK - compiling with  -DUSE_RTL_POPEN solved my problem, but introduces some other.

Perl compiled with that option did not pass the tests.
Some time later I was able to find the problem​:
win32_popen modifies stdout handle so
  A) It should not be called if there is some operation in progress on stdout in another thread
  B) There is a race condition on modifying stdout.
Attached patch ( popen5a,patch ) for perl 5.8.8 solved the problem.
 For problem A I used critical section for files used by RTL.
 For problem B I used a new critical section ( I added initialization to Perl_win32_init ).

The patch cannot be used with newer perls, because "critical section for files used by RTL" ( _pioinfo ) is no longer defined in Win32.c

________________________________
From​: James E Keenan via RT <perlbug-followup@​perl.org>
To​: krzysztofk@​rocketmail.com
Sent​: Monday, May 27, 2013 8​:06 AM
Subject​: [perl #38723] Backticks don't work in Win32 multithreaded perl

On Mon Mar 13 19​:17​:18 2006, krzysztofk wrote​:

This is a bug report for perl from
krzysztofk@​rocketmail.com,
generated with the help of perlbug 1.34 running under
perl v5.8.0.

-----------------------------------------------------------------
[Please enter your report here]
In short when I use fork under Win32 backticks don't
work properly.
Following program instead of printing long list of
lines like
"Process x iteration y" stops writing after just a few
iteration
and does not exit.
I looked through the code and found the problem.
Function win32_popen is not thread safe.
Recompiling perl with -DUSE_RTL_POPEN fixes the
problem.

sub run_p($)
{
    my($num) = @​_;
    print "Process $num($$) started.\n";
    for(1..20){
        `dir`;
        print "Process $num iteration $_\n";
    }
    print LOG "Process $num done.\n";
}

$|=1;
my $NFORK=6;
open LOG,">log.txt";
for(1..$NFORK){
    my $pid;
    if(($pid=fork())){
        print "Starting process $_($pid)\n";
        $num{$pid} = $_;
    }
    else{
        sleep 1;
        run_p($_);
        exit;
    }
}
for(1..$NFORK){
    my $pid= wait();
    print STDERR "Wait returned $pid ($num{$pid})\n";
}

Reviewing older tickets this morning, I came across this one.

Krzysztofk​:  It appears that by re-compiling Perl, you found a
satisfactory work-around.  Do you need further assistance with this problem?

List​: Could someone familiar with the current status of 'fork' on Win32
systems please assess the issues in this ticket?

Thank you very much.
Jim Keenan

@p5pRT
Copy link
Author

p5pRT commented May 29, 2013

From krzysztofk@rocketmail.com

popen5a.patch
*** win32.c.orig	Tue Dec 18 04:47:08 2007
--- win32.c	Tue Feb 05 13:43:37 2008
***************
*** 2979,2984 ****
--- 2979,2989 ----
   *
   * changed to return PerlIO* rather than FILE * by BKS, 11-11-2000
   */
+ #ifndef USE_RTL_POPEN
+ #ifdef MUTEX_LOCK
+ static CRITICAL_SECTION popen_mutex;
+ #endif
+ #endif
  
  DllExport PerlIO*
  win32_popen(const char *command, const char *mode)
***************
*** 3033,3038 ****
--- 3038,3045 ----
      old_h = GetStdHandle(nhandle);
  
      /* save current stdfd */
+     EnterCriticalSection(&popen_mutex);
+     EnterCriticalSection(&(_pioinfo(stdfd)->lock));
      if ((oldfd = win32_dup(stdfd)) == -1)
          goto cleanup;
  
***************
*** 3059,3064 ****
--- 3066,3072 ----
  
  	/* close saved handle */
  	win32_close(oldfd);
+ 	LeaveCriticalSection(&(_pioinfo(stdfd)->lock));
  
  	/* restore the old std handle (this needs to happen after the
  	 * dup2(), since that might call SetStdHandle() too */
***************
*** 3077,3082 ****
--- 3085,3091 ----
      }
  
      /* we have an fd, return a file stream */
+     LeaveCriticalSection(&popen_mutex);
      return (PerlIO_fdopen(p[parent], (char *)mode));
  
  cleanup:
***************
*** 3092,3097 ****
--- 3101,3108 ----
  	OP_REFCNT_UNLOCK;
  	lock_held = 0;
      }
+     LeaveCriticalSection(&(_pioinfo(stdfd)->lock));
+     LeaveCriticalSection(&popen_mutex);
      return (NULL);
  
  #endif /* USE_RTL_POPEN */
***************
*** 4790,4795 ****
--- 4801,4809 ----
  #endif
      MALLOC_INIT;
  
+ #ifndef USE_RTL_POPEN        
+     InitializeCriticalSection(&popen_mutex);
+ #endif                       
      module = GetModuleHandle("ntdll.dll");
      if (module) {
          *(FARPROC*)&pfnZwQuerySystemInformation = GetProcAddress(module, "ZwQuerySystemInformation");

@p5pRT
Copy link
Author

p5pRT commented May 29, 2013

From @bulk88

On Tue May 28 17​:25​:06 2013, krzysztofk wrote​:

OK - compiling with� -DUSE_RTL_POPEN solved my problem, but introduces
some other.

Perl compiled with that option did not pass the tests.
Some time later I was able to find the problem​:
win32_popen modifies stdout handle so
� A) It should not be called if there is some operation in progress on
stdout in another thread
� B) There is a race condition on modifying stdout.
Attached patch ( popen5a,patch ) for perl 5.8.8 solved the problem.
�For problem A I used critical section for files used by RTL.
�For problem B I used a new critical section ( I added initialization
to Perl_win32_init ).

The patch cannot be used with newer perls, because "critical section
for files used by RTL" ( _pioinfo ) is no longer defined in Win32.c

Turns out I was wrong. There is a bug here. In my output I posted above
I didn't notice iteration "3" and "4" only appeared once. _pioinfo is a
symbol that is a pointer to an array of ioinfo structs within the MS
CRT. You can't just acquire the CS in the pioinfo, there is another
member that needs to be checked.
http​://perl5.git.perl.org/perl.git/commitdiff/9b1f18150adf6630261f4d4a81b0a75ba6abaf97
is where Perl's use of _pioinfo was removed. There already is a
serialization lock in win32_popen " OP_REFCNT_LOCK;". Why isn't it
"working"?

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Mar 24, 2014

From @tonycoz

On Tue May 28 23​:47​:56 2013, bulk88 wrote​:

Turns out I was wrong. There is a bug here. In my output I posted
above
I didn't notice iteration "3" and "4" only appeared once. _pioinfo is
a
symbol that is a pointer to an array of ioinfo structs within the MS
CRT. You can't just acquire the CS in the pioinfo, there is another
member that needs to be checked.
http​://perl5.git.perl.org/perl.git/commitdiff/9b1f18150adf6630261f4d4a81b0a75ba6abaf97
is where Perl's use of _pioinfo was removed. There already is a
serialization lock in win32_popen " OP_REFCNT_LOCK;". Why isn't it
"working"?

It's possible I've fixed this in f06c882 which avoids modifying the global stdin/out handles when creating a popen() process.

Tony

@p5pRT
Copy link
Author

p5pRT commented Mar 24, 2014

From @tonycoz

On Sun Mar 23 21​:40​:25 2014, tonyc wrote​:

It's possible I've fixed this in
f06c882 which avoids modifying the
global stdin/out handles when creating a popen() process.

I tested with 64-bit 5.18.1 and blead@​v5.19.8-291-ga27b5f5*.

Neither locked up, but 5.18.1 did drop a lot of output.

blead produced a lot more output and appears to have output a line for each iteration of the "child processes".

I'll close this soon unless someone objects.

Tony

@p5pRT
Copy link
Author

p5pRT commented Mar 24, 2014

From @bulk88

On Sun Mar 23 22​:16​:54 2014, tonyc wrote​:

On Sun Mar 23 21​:40​:25 2014, tonyc wrote​:

It's possible I've fixed this in
f06c882 which avoids modifying the
global stdin/out handles when creating a popen() process.

I tested with 64-bit 5.18.1 and blead@​v5.19.8-291-ga27b5f5*.

Neither locked up, but 5.18.1 did drop a lot of output.

blead produced a lot more output and appears to have output a line for
each iteration of the "child processes".

I'll close this soon unless someone objects.

Tony

I got AP 5.10 to hang, it takes 3-8 trys before it hangs with a slightly tweaked script.


sub run_p($)
{
  my($num) = @​_;
  print "Process $num($$) started.\n";
  for(1..20){
  `dir`;
  print "Process $num iteration $_\n";
  }
  print LOG "Process $num done.\n";
}

$|=1;
my $NFORK=20;
open LOG,">log.txt";
for(1..$NFORK){
  my $pid;
  if(($pid=fork())){
  #print "Starting process $_($pid)\n";
  $num{$pid} = $_;
  }
  else{
  sleep 1;
  run_p($_);
  exit;
  }
}
for(1..$NFORK){
  my $pid= wait();
  print STDERR "Wait returned $pid ($num{$pid})\n";
}



  ntdll.dll!_KiFastSystemCallRet@​0()
  ntdll.dll!_ZwWaitForMultipleObjects@​20() + 0xc
  kernel32.dll!_WaitForMultipleObjectsEx@​20() - 0x48
  user32.dll!_RealMsgWaitForMultipleObjectsEx@​20() + 0xd9
  user32.dll!_MsgWaitForMultipleObjects@​20() + 0x1f
  perl510.dll!win32_msgwait(interpreter * my_perl=0x00234164, unsigned long count=20, void * * handles=0x0023f4a0, unsigned long timeout=4294967295, unsigned long * resultp=0x0140fa74) Line 2160 + 0x15 C
  perl510.dll!win32_internal_wait(int * status=0x0140fafc, unsigned long timeout=4294967295) Line 2202 C
  perl510.dll!win32_waitpid(int pid=-1, int * status=0x0140fafc, int flags=0) Line 2259 + 0x9 C
  perl510.dll!PerlProcWaitpid(IPerlProc * piPerl=0x00235a98, int pid=-1, int * status=0x0140fafc, int flags=0) Line 1690 + 0x11 C++
  perl510.dll!Perl_wait4pid(interpreter * my_perl=0x00234164, int pid=-1, int * statusp=0x0140fafc, int flags=0) Line 2925 + 0x17 C
  perl510.dll!Perl_pp_wait(interpreter * my_perl=0x00234164) Line 4010 + 0xa C
  perl510.dll!Perl_runops_standard(interpreter * my_perl=0x00234164) Line 36 + 0xc C
  perl510.dll!S_run_body(interpreter * my_perl=0x00234164, long oldscope=1) Line 2385 + 0x7 C
  perl510.dll!perl_run(interpreter * my_perl=0x00234164) Line 2303 + 0xa C
  perl510.dll!RunPerl(int argc=2, char * * argv=0x00233f08, char * * env=0x01232d08) Line 266 + 0x6 C++
  perl.exe!main(int argc=2, char * * argv=0x00233f08, char * * env=0x00232d08) Line 22 + 0x12 C
  perl.exe!_mainCRTStartup() + 0xe3
  kernel32.dll!_BaseProcessStart@​4() + 0x23


  ntdll.dll!_RtlpWaitForCriticalSection@​4() + 0x8c
  ntdll.dll!_RtlEnterCriticalSection@​4() + 0x46
  msvcrt.dll!__lock_fhandle() + 0x70
  msvcrt.dll!__write() + 0x3d
  perl510.dll!win32_write(int fd=1, const void * buf=0x07ae0a04, unsigned int cnt=23) Line 3701 + 0x12 C
  perl510.dll!PerlLIOWrite(IPerlLIO * piPerl=0x01830cd4, int handle=1, const void * buffer=0x07ae0a04, unsigned int count=23) Line 1094 + 0x11 C++
  perl510.dll!PerlIOUnix_write(interpreter * my_perl=0x01834f2c, _PerlIO * * f=0x0183e35c, const void * vbuf=0x07ae0a04, unsigned int count=23) Line 2711 + 0x1a C
  perl510.dll!Perl_PerlIO_write(interpreter * my_perl=0x01834f2c, _PerlIO * * f=0x0183e35c, const void * vbuf=0x07ae0a04, unsigned int count=23) Line 1643 + 0x2b C
  perl510.dll!PerlIOBuf_flush(interpreter * my_perl=0x01834f2c, _PerlIO * * f=0x07ae0a04) Line 3748 + 0x10 C
  perl510.dll!PerlIOCrlf_flush(interpreter * my_perl=0x01834f2c, _PerlIO * * f=0x0183e1b4) Line 4585 + 0xa C
  perl510.dll!Perl_PerlIO_flush(interpreter * my_perl=0x01834f2c, _PerlIO * * f=0x0183e1b4) Line 1668 + 0x6 C
  perl510.dll!PerlIOCrlf_write(interpreter * my_perl=0x01834f2c, _PerlIO * * f=0x0183e1b4, const void * vbuf=0x07aed4f4, unsigned int count=128898314) Line 4566 + 0x9 C
  perl510.dll!Perl_PerlIO_write(interpreter * my_perl=0x01834f2c, _PerlIO * * f=0x0183e1b4, const void * vbuf=0x07aed4f4, unsigned int count=22) Line 1643 + 0x2b C
  perl510.dll!Perl_do_print(interpreter * my_perl=0x01834f2c, sv * sv=0x0183ba94, _PerlIO * * fp=0x0183e1b4) Line 1247 + 0x13 C
  perl510.dll!Perl_pp_print(interpreter * my_perl=0x018549d0) Line 778 + 0xb C
  perl510.dll!Perl_runops_standard(interpreter * my_perl=0x01834f2c) Line 36 + 0xc C
  perl510.dll!win32_start_child(void * arg=0x01834f2c) Line 1769 + 0x7 C++
  kernel32.dll!_BaseThreadStart@​8() + 0x37


  ntdll.dll!_KiFastSystemCallRet@​0()
  ntdll.dll!_ZwWaitForSingleObject@​12() + 0xc
  ntdll.dll!_RtlpWaitForCriticalSection@​4() + 0x8c
  ntdll.dll!_RtlEnterCriticalSection@​4() + 0x46
  msvcrt.dll!__lock_fhandle() + 0x70
  msvcrt.dll!__dup2() + 0x74
  perl510.dll!win32_dup2(int fd1=6, int fd2=1) Line 3489 + 0xe C
  perl510.dll!win32_popen(const char * command=0x00001f4c, const char * mode=0x280b3b1c) Line 3055 + 0xb C
  perl510.dll!PerlProcPopen(IPerlProc * piPerl=0x01851d70, const char * command=0x0186825c, const char * mode=0x280b3b1c) Line 1635 + 0xd C++
  perl510.dll!Perl_pp_backtick(interpreter * my_perl=0x0186825c) Line 316 + 0xe C
  perl510.dll!Perl_runops_standard(interpreter * my_perl=0x01852914) Line 36 + 0xc C
  perl510.dll!win32_start_child(void * arg=0x01852914) Line 1769 + 0x7 C++
  kernel32.dll!_BaseThreadStart@​8() + 0x37


ll child threads with this identical call stack


  ntdll.dll!_KiFastSystemCallRet@​0()
  ntdll.dll!_ZwWaitForSingleObject@​12() + 0xc
  ntdll.dll!_RtlpWaitForCriticalSection@​4() + 0x8c
  ntdll.dll!_RtlEnterCriticalSection@​4() + 0x46
  perl510.dll!win32_popen(const char * command=0x0188a1cc, const char * mode=0x280b3b1c) Line 3031 C
  perl510.dll!PerlProcPopen(IPerlProc * piPerl=0x0187a8e8, const char * command=0x0188a1cc, const char * mode=0x280b3b1c) Line 1635 + 0xd C++
  perl510.dll!Perl_pp_backtick(interpreter * my_perl=0x0188a1cc) Line 316 + 0xe C
  perl510.dll!Perl_runops_standard(interpreter * my_perl=0x01873694) Line 36 + 0xc C
  perl510.dll!win32_start_child(void * arg=0x01873694) Line 1769 + 0x7 C++
  kernel32.dll!_BaseThreadStart@​8() + 0x37


7 child threads with this call stack


  ntdll.dll!_KiFastSystemCallRet@​0()
  ntdll.dll!_ZwWaitForSingleObject@​12() + 0xc
  ntdll.dll!_RtlpWaitForCriticalSection@​4() + 0x8c
  ntdll.dll!_RtlEnterCriticalSection@​4() + 0x46
  msvcrt.dll!__lock_fhandle() + 0x70
  msvcrt.dll!__write() + 0x3d
  perl510.dll!win32_write(int fd=1, const void * buf=0x07aef88c, unsigned int cnt=24) Line 3701 + 0x12 C
  perl510.dll!PerlLIOWrite(IPerlLIO * piPerl=0x079e9d4c, int handle=1, const void * buffer=0x07aef88c, unsigned int count=24) Line 1094 + 0x11 C++
  perl510.dll!PerlIOUnix_write(interpreter * my_perl=0x079eaa14, _PerlIO * * f=0x079f7b24, const void * vbuf=0x07aef88c, unsigned int count=24) Line 2711 + 0x1a C
  perl510.dll!Perl_PerlIO_write(interpreter * my_perl=0x079eaa14, _PerlIO * * f=0x079f7b24, const void * vbuf=0x07aef88c, unsigned int count=24) Line 1643 + 0x2b C
  perl510.dll!PerlIOBuf_flush(interpreter * my_perl=0x079eaa14, _PerlIO * * f=0x07aef88c) Line 3748 + 0x10 C
  perl510.dll!PerlIOCrlf_flush(interpreter * my_perl=0x079eaa14, _PerlIO * * f=0x079f797c) Line 4585 + 0xa C
  perl510.dll!Perl_PerlIO_flush(interpreter * my_perl=0x079eaa14, _PerlIO * * f=0x079f797c) Line 1668 + 0x6 C
  perl510.dll!PerlIOCrlf_write(interpreter * my_perl=0x079eaa14, _PerlIO * * f=0x079f797c, const void * vbuf=0x07afc4cc, unsigned int count=128959715) Line 4566 + 0x9 C
  perl510.dll!Perl_PerlIO_write(interpreter * my_perl=0x079eaa14, _PerlIO * * f=0x079f797c, const void * vbuf=0x07afc4cc, unsigned int count=23) Line 1643 + 0x2b C
  perl510.dll!Perl_do_print(interpreter * my_perl=0x079eaa14, sv * sv=0x019f52a4, _PerlIO * * fp=0x079f797c) Line 1247 + 0x13 C
  perl510.dll!Perl_pp_print(interpreter * my_perl=0x07a10950) Line 778 + 0xb C
  perl510.dll!Perl_runops_standard(interpreter * my_perl=0x079eaa14) Line 36 + 0xc C
  perl510.dll!win32_start_child(void * arg=0x079eaa14) Line 1769 + 0x7 C++
  kernel32.dll!_BaseThreadStart@​8() + 0x37


The perl OS process has a blocked cmd.exe child proc under it launched as "cmd.exe /x/d/c dir". IDK which perl fork thread is supposed to be reading from the cmd.exe process. I won't debug this very throughly but I'll look at it in another post, because, doing a perl -E" for(0..200){system('perl winhang.pl');}" with blead at http​://perl5.git.perl.org/perl.git/commit/e9251c1a8f4944e6dceff5240d9e109ba075ff29 never hanged for me.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Mar 24, 2014

From @bulk88

The deadlock is like this, from outer most lock waiter, to lock owner.


  ntdll.dll!_KiFastSystemCallRet@​0()
  ntdll.dll!_ZwWaitForSingleObject@​12() + 0xc
  ntdll.dll!_RtlpWaitForCriticalSection@​4() + 0x8c
  ntdll.dll!_RtlEnterCriticalSection@​4() + 0x46
  msvcrt.dll!__lock_fhandle() + 0x70
  msvcrt.dll!__write() + 0x3d
  perl510.dll!win32_write(int fd=1, const void * buf=0x07af4324, unsigned int cnt=25) Line 3701 + 0x12 C
  perl510.dll!PerlLIOWrite(IPerlLIO * piPerl=0x07a57cc4, int handle=1, const void * buffer=0x07af4324, unsigned int count=25) Line 1094 + 0x11 C++
  perl510.dll!PerlIOUnix_write(interpreter * my_perl=0x07a50964, _PerlIO * * f=0x07a5e31c, const void * vbuf=0x07af4324, unsigned int count=25) Line 2711 + 0x1a C
  perl510.dll!Perl_PerlIO_write(interpreter * my_perl=0x07a50964, _PerlIO * * f=0x07a5e31c, const void * vbuf=0x07af4324, unsigned int count=25) Line 1643 + 0x2b C
  perl510.dll!PerlIOBuf_flush(interpreter * my_perl=0x07a50964, _PerlIO * * f=0x07af4324) Line 3748 + 0x10 C
  perl510.dll!PerlIOCrlf_flush(interpreter * my_perl=0x07a50964, _PerlIO * * f=0x07a5e174) Line 4585 + 0xa C
  perl510.dll!Perl_PerlIO_flush(interpreter * my_perl=0x07a50964, _PerlIO * * f=0x07a5e174) Line 1668 + 0x6 C
  perl510.dll!PerlIOCrlf_write(interpreter * my_perl=0x07a50964, _PerlIO * * f=0x07a5e174, const void * vbuf=0x07aff8fc, unsigned int count=128973076) Line 4566 + 0x9 C
  perl510.dll!Perl_PerlIO_write(interpreter * my_perl=0x07a50964, _PerlIO * * f=0x07a5e174, const void * vbuf=0x07aff8fc, unsigned int count=24) Line 1643 + 0x2b C
  perl510.dll!Perl_do_print(interpreter * my_perl=0x07a50964, sv * sv=0x01a5ba8c, _PerlIO * * fp=0x07a5e174) Line 1247 + 0x13 C
  perl510.dll!Perl_pp_print(interpreter * my_perl=0x07a77220) Line 778 + 0xb C
  perl510.dll!Perl_runops_standard(interpreter * my_perl=0x07a50964) Line 36 + 0xc C
  perl510.dll!win32_start_child(void * arg=0x07a50964) Line 1769 + 0x7 C++
  kernel32.dll!_BaseThreadStart@​8() + 0x37


at " print "Process $num iteration $_\n";" waits on CS held by thread


  ntdll.dll!_KiFastSystemCallRet@​0()
  ntdll.dll!_ZwWriteFile@​36() + 0xc
  kernel32.dll!_WriteFile@​20() + 0x6f
  msvcrt.dll!__write_lk() + 0x10f
  msvcrt.dll!__write() + 0x57
  perl510.dll!win32_write(int fd=1, const void * buf=0x07aea76c, unsigned int cnt=25) Line 3701 + 0x12 C
  perl510.dll!PerlLIOWrite(IPerlLIO * piPerl=0x07968ccc, int handle=1, const void * buffer=0x07aea76c, unsigned int count=25) Line 1094 + 0x11 C++
  perl510.dll!PerlIOUnix_write(interpreter * my_perl=0x07961c4c, _PerlIO * * f=0x0796f374, const void * vbuf=0x07aea76c, unsigned int count=25) Line 2711 + 0x1a C
  perl510.dll!Perl_PerlIO_write(interpreter * my_perl=0x07961c4c, _PerlIO * * f=0x0796f374, const void * vbuf=0x07aea76c, unsigned int count=25) Line 1643 + 0x2b C
  perl510.dll!PerlIOBuf_flush(interpreter * my_perl=0x07961c4c, _PerlIO * * f=0x07aea76c) Line 3748 + 0x10 C
  perl510.dll!PerlIOCrlf_flush(interpreter * my_perl=0x07961c4c, _PerlIO * * f=0x0796f1cc) Line 4585 + 0xa C
  perl510.dll!Perl_PerlIO_flush(interpreter * my_perl=0x07961c4c, _PerlIO * * f=0x0796f1cc) Line 1668 + 0x6 C
  perl510.dll!PerlIOCrlf_write(interpreter * my_perl=0x07961c4c, _PerlIO * * f=0x0796f1cc, const void * vbuf=0x07ae8114, unsigned int count=128876844) Line 4566 + 0x9 C
  perl510.dll!Perl_PerlIO_write(interpreter * my_perl=0x07961c4c, _PerlIO * * f=0x0796f1cc, const void * vbuf=0x07ae8114, unsigned int count=24) Line 1643 + 0x2b C
  perl510.dll!Perl_do_print(interpreter * my_perl=0x07961c4c, sv * sv=0x0196ca8c, _PerlIO * * fp=0x0796f1cc) Line 1247 + 0x13 C
  perl510.dll!Perl_pp_print(interpreter * my_perl=0x079880f8) Line 778 + 0xb C
  perl510.dll!Perl_runops_standard(interpreter * my_perl=0x07961c4c) Line 36 + 0xc C
  perl510.dll!win32_start_child(void * arg=0x07961c4c) Line 1769 + 0x7 C++
  kernel32.dll!_BaseThreadStart@​8() + 0x37


which is at " print "Process $num iteration $_\n";"

I can't easily trace this any further since this is blocked IO now.

Another kind of thread in the process


  ntdll.dll!_KiFastSystemCallRet@​0()
  ntdll.dll!_ZwWaitForSingleObject@​12() + 0xc
  ntdll.dll!_RtlpWaitForCriticalSection@​4() + 0x8c
  ntdll.dll!_RtlEnterCriticalSection@​4() + 0x46
  perl510.dll!win32_popen(const char * command=0x0799a924, const char * mode=0x280b3b1c) Line 3031 C
  perl510.dll!PerlProcPopen(IPerlProc * piPerl=0x07983608, const char * command=0x0799a924, const char * mode=0x280b3b1c) Line 1635 + 0xd C++
  perl510.dll!Perl_pp_backtick(interpreter * my_perl=0x0799a924) Line 316 + 0xe C
  perl510.dll!Perl_runops_standard(interpreter * my_perl=0x07983f5c) Line 36 + 0xc C
  perl510.dll!win32_start_child(void * arg=0x07983f5c) Line 1769 + 0x7 C++
  kernel32.dll!_BaseThreadStart@​8() + 0x37


at line " `dir`;" is waiting on CS held by thread


  ntdll.dll!_KiFastSystemCallRet@​0()
  ntdll.dll!_ZwWaitForSingleObject@​12() + 0xc
  ntdll.dll!_RtlpWaitForCriticalSection@​4() + 0x8c
  ntdll.dll!_RtlEnterCriticalSection@​4() + 0x46
  msvcrt.dll!__lock_fhandle() + 0x70
  msvcrt.dll!__dup2() + 0x74
  perl510.dll!win32_dup2(int fd1=15, int fd2=1) Line 3489 + 0xe C
  perl510.dll!win32_popen(const char * command=0x00002b3c, const char * mode=0x280b3b1c) Line 3055 + 0xb C
  perl510.dll!PerlProcPopen(IPerlProc * piPerl=0x01902a28, const char * command=0x01912394, const char * mode=0x280b3b1c) Line 1635 + 0xd C++
  perl510.dll!Perl_pp_backtick(interpreter * my_perl=0x01912394) Line 316 + 0xe C
  perl510.dll!Perl_runops_standard(interpreter * my_perl=0x018fb5b4) Line 36 + 0xc C
  perl510.dll!win32_start_child(void * arg=0x018fb5b4) Line 1769 + 0x7 C++
  kernel32.dll!_BaseThreadStart@​8() + 0x37


which is at line " `dir`;" which is waiting on CS lock held by thread (we saw this thread above already)


  ntdll.dll!_KiFastSystemCallRet@​0()
  ntdll.dll!_ZwWriteFile@​36() + 0xc
  kernel32.dll!_WriteFile@​20() + 0x6f
  msvcrt.dll!__write_lk() + 0x10f
  msvcrt.dll!__write() + 0x57
  perl510.dll!win32_write(int fd=1, const void * buf=0x07aea76c, unsigned int cnt=25) Line 3701 + 0x12 C
  perl510.dll!PerlLIOWrite(IPerlLIO * piPerl=0x07968ccc, int handle=1, const void * buffer=0x07aea76c, unsigned int count=25) Line 1094 + 0x11 C++
  perl510.dll!PerlIOUnix_write(interpreter * my_perl=0x07961c4c, _PerlIO * * f=0x0796f374, const void * vbuf=0x07aea76c, unsigned int count=25) Line 2711 + 0x1a C
  perl510.dll!Perl_PerlIO_write(interpreter * my_perl=0x07961c4c, _PerlIO * * f=0x0796f374, const void * vbuf=0x07aea76c, unsigned int count=25) Line 1643 + 0x2b C
  perl510.dll!PerlIOBuf_flush(interpreter * my_perl=0x07961c4c, _PerlIO * * f=0x07aea76c) Line 3748 + 0x10 C
  perl510.dll!PerlIOCrlf_flush(interpreter * my_perl=0x07961c4c, _PerlIO * * f=0x0796f1cc) Line 4585 + 0xa C
  perl510.dll!Perl_PerlIO_flush(interpreter * my_perl=0x07961c4c, _PerlIO * * f=0x0796f1cc) Line 1668 + 0x6 C
  perl510.dll!PerlIOCrlf_write(interpreter * my_perl=0x07961c4c, _PerlIO * * f=0x0796f1cc, const void * vbuf=0x07ae8114, unsigned int count=128876844) Line 4566 + 0x9 C
  perl510.dll!Perl_PerlIO_write(interpreter * my_perl=0x07961c4c, _PerlIO * * f=0x0796f1cc, const void * vbuf=0x07ae8114, unsigned int count=24) Line 1643 + 0x2b C
  perl510.dll!Perl_do_print(interpreter * my_perl=0x07961c4c, sv * sv=0x0196ca8c, _PerlIO * * fp=0x0796f1cc) Line 1247 + 0x13 C
  perl510.dll!Perl_pp_print(interpreter * my_perl=0x079880f8) Line 778 + 0xb C
  perl510.dll!Perl_runops_standard(interpreter * my_perl=0x07961c4c) Line 36 + 0xc C
  perl510.dll!win32_start_child(void * arg=0x07961c4c) Line 1769 + 0x7 C++
  kernel32.dll!_BaseThreadStart@​8() + 0x37


--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Mar 24, 2014

From @bulk88

On perl512 DEBUGGING (not sure if that is relevent), lock holder loop happened.

thread


  ntdll.dll!_KiFastSystemCallRet@​0()
  ntdll.dll!_ZwWaitForSingleObject@​12() + 0xc
  ntdll.dll!_RtlpWaitForCriticalSection@​4() + 0x8c
  ntdll.dll!_RtlEnterCriticalSection@​4() + 0x46
  perl512.dll!win32_popen(const char * command=0x00890144, const char * mode=0x28206874) Line 3065 C
  perl512.dll!PerlProcPopen(IPerlProc * piPerl=0x00287190, const char * command=0x00890144, const char * mode=0x28206874) Line 1637 + 0xd C++
  perl512.dll!Perl_pp_backtick(interpreter * my_perl=0x00876e54) Line 309 + 0x1e C
  perl512.dll!Perl_runops_debug(interpreter * my_perl=0x00876e54) Line 2049 + 0xd C
  perl512.dll!win32_start_child(void * arg=0x00876e54) Line 1771 + 0xd C++
  kernel32.dll!_BaseThreadStart@​8() + 0x37


is at line " `dir`;" and waits on TID 11560


  ntdll.dll!_KiFastSystemCallRet@​0()
  ntdll.dll!_ZwWaitForSingleObject@​12() + 0xc
  ntdll.dll!_RtlpWaitForCriticalSection@​4() + 0x8c
  ntdll.dll!_RtlEnterCriticalSection@​4() + 0x46
  msvcr71.dll!_lock(int locknum=11) Line 319 + 0x8 C
  msvcr71.dll!_alloc_osfhnd() Line 59 + 0x7 C
  msvcr71.dll!_dup_lk(int fh=1) Line 104 + 0x5 C
  msvcr71.dll!_dup(int fh=1) Line 74 + 0x6 C
  perl512.dll!win32_dup(int fd=1) Line 3535 + 0xa C
  perl512.dll!win32_popen(const char * command=0x0084868c, const char * mode=0x28206874) Line 3069 + 0x9 C
  perl512.dll!PerlProcPopen(IPerlProc * piPerl=0x00286278, const char * command=0x0084868c, const char * mode=0x28206874) Line 1637 + 0xd C++
  perl512.dll!Perl_pp_backtick(interpreter * my_perl=0x0083093c) Line 309 + 0x1e C
  perl512.dll!Perl_runops_debug(interpreter * my_perl=0x0083093c) Line 2049 + 0xd C
  perl512.dll!win32_start_child(void * arg=0x0083093c) Line 1771 + 0xd C++
  kernel32.dll!_BaseThreadStart@​8() + 0x37


is at line " `dir`;" and waits on TID 6824


  ntdll.dll!_KiFastSystemCallRet@​0()
  ntdll.dll!_ZwWaitForSingleObject@​12() + 0xc
  ntdll.dll!_RtlpWaitForCriticalSection@​4() + 0x8c
  ntdll.dll!_RtlEnterCriticalSection@​4() + 0x46
  msvcr71.dll!_alloc_osfhnd() Line 112 C
  msvcr71.dll!_pipe(int * phandles=0x00b9fd9c, unsigned int psize=512, int textmode=128) Line 87 + 0x5 C
  perl512.dll!win32_pipe(int * pfd=0x00b9fd9c, unsigned int size=512, int mode=128) Line 2999 + 0x12 C
  perl512.dll!win32_popen(const char * command=0x009a64fc, const char * mode=0x28206874) Line 3059 + 0x12 C
  perl512.dll!PerlProcPopen(IPerlProc * piPerl=0x00289a30, const char * command=0x009a64fc, const char * mode=0x28206874) Line 1637 + 0xd C++
  perl512.dll!Perl_pp_backtick(interpreter * my_perl=0x0098d3bc) Line 309 + 0x1e C
  perl512.dll!Perl_runops_debug(interpreter * my_perl=0x0098d3bc) Line 2049 + 0xd C
  perl512.dll!win32_start_child(void * arg=0x0098d3bc) Line 1771 + 0xd C++
  kernel32.dll!_BaseThreadStart@​8() + 0x37


is at line " `dir`;" and waits on TID 11560 (a loop)

I've seen this before on Perl RT and wrote this up, about CRT global "lock 11". https://rt-archive.perl.org/perl5/Ticket/Display.html?id=87410  Note the perl510 stacks showed a block on a WriteFile. On my 8 core machine (im not making any stacks from it), it takes NFORK = 60 to get a frequent (1 in 10 or better hangs) hang on Active non-debugging Perl 5.12. On the one that gave all the callstacks in this post and last is a 2 core machine. Strawberry 5.14 at NFORK 60 hangs on 8 core. ActivePerl 5.16 at NFORK 60 hangs on 8 core. ActivePerl 5.18 hangs at NFORK 60 on 8 core at NFORK 60. Perl random blead self compiled calling itself 5.19.4 hangs on WriteFile. Like the 5.10 call stacks. I can't rule out that some of the hangs are the lock 11 bug, or that both WriteFile and lock 11 randomly cause hangs.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Mar 25, 2014

From @bulk88

Running the sample script for 7 hours straight at 100% CPU with 5.19.10, it never hung , same when I rant it for 200 rounds with that 5.19.10 yesterday. I guess close it.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT p5pRT closed this as completed Mar 25, 2014
@p5pRT
Copy link
Author

p5pRT commented Mar 25, 2014

@iabyn - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant