develooper Front page | perl.perl5.porters | Postings from August 2003

[perl #23332] RE: Win32 pipe/fork or filehandle I/O deadlock bug

From:
Sean.Hunter@gs.com
Date:
August 15, 2003 10:50
Subject:
[perl #23332] RE: Win32 pipe/fork or filehandle I/O deadlock bug
Message ID:
rt-23332-62716.0.38028378951779@rt.perl.org
# New Ticket Created by  Sean.Hunter@gs.com 
# Please include the string:  [perl #23332]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=23332 >


FWIW IO::Pipe seems to function ok.

Sean

-----Original Message-----
From: huntse@jany.gs.com [mailto:huntse@jany.gs.com] 
Sent: Friday, August 15, 2003 5:43 PM
To: perlbug@perl.org
Cc: ficcs-installmeister
Subject: Win32 pipe/fork or filehandle I/O deadlock bug



This is a bug report for perl from sean.hunter@gs.com, generated with the
help of perlbug 1.33 running under perl v5.6.1.

To: perlbug@perl.org
Subject: Win32 pipe/fork bug
Cc: ficcs-installmeister@ny.email.gs.com
Reply-To: ficcs-installmeister@ny.email.gs.com
Message-Id: <5.8.0_536_1060965069@jeeves.fi.gs.com>

This is a bug report for perl from ficcs-installmeister@ny.email.gs.com,
generated with the help of perlbug 1.34 running under perl v5.8.0.


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

Hi there

The following code, (copied directly from perlfork.pod) deadlocks on Win32
(XP and NT4) under 5.8.0.  5.6.1 on Win32 and 5.8.0 on Solaris and Linux
work fine for me.  I have tried the same code with a build without PERLIO
and the standard ActiveState perl 5.8.0.  The AS perl deadlocks and sits
there until interrupted.  The build without PERLIO exits without printing
the message.  I have tried various settings of the PERLIO environment
variable without any noticable effect.

FWIW I see the same behaviour with tcp sockets between the parent and child
processes.

Cheers

Sean

# simulate open(FOO, "-|")
sub pipe_from_fork ($) {
	my $parent = shift;
	pipe $parent, my $child or die;
	my $pid = fork();
	die "fork() failed: $!" unless defined $pid;
	if ($pid) {
		close $child;
	}
	else {
		close $parent;
		open(STDOUT, ">&=" . fileno($child)) or die;
	}
	$pid;
}

if (pipe_from_fork('BAR')) {
	# parent
	while (<BAR>) { print; }
	close BAR;
}
else {
	# child
	print "pipe_from_fork certified \"100% Probably Working [tm]\"!
Have a nice day.\n";
	close STDOUT;
	exit(0);
}



[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=high
---
Site configuration information for perl v5.8.0:

Configured by huntse at Wed Jun 18 18:43:25 2003.

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 -O1 -DWIN32 -D_CONSOLE
-DNO_STRICT   -DDEBUGGING -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
-DUSE_PERLIO -DPERL_MSVCRT_READFIX',
    optimize='-MD -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='off_t',
lseeksize=4
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -release
-libpath:"I:\sw\external\perl-5.8.0\lib\CORE"  -machine:x86'
    libpth=C:\local\apps\GS\Micros~3\VC98\lib I:\sw\external\utils\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:"I:\sw\external\perl-5.8.0\lib\CORE"  -machine:x86'

Locally applied patches:
    

---
@INC for perl v5.8.0:
    i:/sw/external/perl-5.8.0/lib
    i:/sw/external/perl-5.8.0/site/lib
    .

---
Environment for perl v5.8.0:
    HOME=z:\
    LANG (unset)
    LANGUAGE=_XP
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
 
PATH=i:\sw\external\perl-5.8.0\bin\;C:\PROGRA~1\Micros~3\VC98\bin;C:\PROGRA~
1\Micros~3\Common\msdev98\bin;i:\sw\external\cygwin-1.3.20-GS\bin;i:\sw\exte
rnal\utils\bin;I:\sw\ficc\wraps\bin;I:\ja\prod\offtrain\dllw32;I:\ja\prod\of
ftrain\utilw32;I:\ja\prod\dllw32;I:\ja\prod\utilw32;I:\sw\external\jdk-1.3\b
in;I:\sw\external\jdk-1.3\jre\bin\hotspot;I:\sw\external\ACE-5.2\bin;C:\Prog
ra~1\Perl\bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Pr
ogram Files\Support Tools\;C:\Program Files\SQLLIB\BIN;C:\Program
Files\SQLLIB\HELP;c:\Program Files\RV\BIN;c:\Program
Files\sybase\OCS-12_0\dll\;c:\Program Files\sybase\OCS-12_0\bin;c:\Program
Files\sybase\asep;c:\Program
Files\sybase\sqlremote\dll;%C:\WINDOWS%\system32;%C:\WINDOWS%;%C:\WINDOWS%\S
ystem32\Wbem;c:\Program
Files\Hummingbird\Connectivity\8.00\Accessories\;;I:\sw\ficc\wraps\bin;Z:\xp
\cmd;Z:\cmd;I:\sw\ficc\links\bin;I:\sw\external\links\bin;I:\sw\external\uti
ls\bin;I:\ja\prod\offtrain\dllw32;I:\ja\prod\offtrain\u
 
tilw32;I:\ja\prod\dllw32;I:\ja\prod\utilw32;I:\mksv51\mksnt;I:\sw\external\R
oguewave-7.1.1\NT40_VC60\lib;I:\sw\external\mkl-rw7.1.1\bin;I:\gnu\bin;I:\vs
lick\win;I:\msvc60_dbug;I:\Util;I:\DLL;I:\sw\external\og-6.0\bin;I:\sw\exter
nal\ACE-5.2\bin;
    PERLIO=perlio
    PERL_BADLANG (unset)
    PERL_PATH=I:\ja\prod\utilw32
    SHELL (unset)
---




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