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
Win32 pipe/fork or filehandle I/O deadlock bug #6704
Comments
From Sean.Hunter@gs.comCreated by sean.hunter@gs.comThis is a bug report for perl from sean.hunter@gs.com, To: perlbug@perl.org This is a bug report for perl from ficcs-installmeister@ny.email.gs.com, ----------------------------------------------------------------- Hi there The following code, (copied directly from perlfork.pod) deadlocks on Win32 (XP FWIW I see the same behaviour with tcp sockets between the parent and child 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);
} Perl Info
|
From perlbug@ericgarland.comI've hit this issue as well. From what I can tell something broke in the fork emulation on Win32 in if ($pid=fork() ) {
sleep(1);
print "parent\n";
} else {
open (STDOUT, ">test.txt");
system("echo child");
} The really nasty effect of this bug is that things appear to work fine It appears that the filehandles aren't getting dup'd anymore when the Does anyone know if the filehandle dup'ing code changed between 5.6 and 5.8? Thanks -Eric |
From @jkeenanThis ticket has languished for many years. Could someone on Win32 Thank you very much. |
The RT System itself - Status changed from 'new' to 'open' |
From @bulk88
|
From @bulk88sub 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);
}
|
Migrated from rt.perl.org#23331 (status was 'open')
Searchable as RT23331$
The text was updated successfully, but these errors were encountered: