Front page | perl.perl5.porters |
Postings from October 1999
[ID 19991025.003] Race condition in devel branch?
From:
Ulrich Pfeifer
Date:
October 25, 1999 08:36
Subject:
[ID 19991025.003] Race condition in devel branch?
Message ID:
19991025153524.4705.qmail@hentai.de.uu.net
This is a bug report for perl from upf@de.uu.net,
generated with the help of perlbug 1.27 running under perl 5.00562.
-----------------------------------------------------------------
The appended script writes two output files with a stable (5.005_03)
perl. When using a devel perl (57, 62) on a Solaris 2.6 system, it
often writes no files, sometimes one file but never two files.
The problem can be reproduced with a miniperl build with gcc version
2.8.1.
The problem cannot be reproduced on Linux.
Any ideas?
Uli
-----------------------------------------------------------------
#!/users/opt/bin/perl -w
my @fh = ();
$SIG{PIPE} = sub { die "whoops, $0 pipe broke" };
my $pid = open(PIPE_TO_KID, "|-");
if (not defined $pid) {
die "Failed to fork: $!";
} elsif (not $pid) {
# child loop: handle any data that is fed to the process via STDIN
while (<>) {
my ($slot, $text) = split /\t/;
print "$$ got for $slot: $text";
if (not defined $fh[$slot]) { # output pipe does not exist yet
$fh[$slot] = "$slot";
my $pipe = "|gzip -c >file.".sprintf("%04d", $slot).".gz";
print "$$: using pipe $pipe\n";
open($fh[$slot], $pipe) or die "Could not open pipe $pipe: $!";
}
print {$fh[$slot]} $text or die "Could not print to $slot: $!";
}
for (@fh) {
close($_) or die "Could not close file handle: $!" if $_;
}
} else {
# parent loop: do some work, then send of any data to the child
for (my $i=0; $i<2; $i++) {
$| = 1; print "parent $$: line $i\n";
print PIPE_TO_KID "$i\tline $i\n" or die "Could not print: $!";
}
close PIPE_TO_KID or die "$$: Failed to close pipe: $!";
}
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Site configuration information for perl 5.00562:
Configured by techdb at Mon Oct 25 16:25:12 MET DST 1999.
Summary of my perl5 (revision 5.0 version 5 subversion 62) configuration:
Platform:
osname=solaris, osvers=2.6, archname=sun4-solaris
uname='sunos billy20 5.6 generic_105181-16 sun4u sparc '
config_args=''
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
use64bits=undef usemultiplicity=undef
Compiler:
cc='gcc', optimize='-O', gccversion=egcs-2.91.66 19990314 (egcs-1.1.2 release)
cppflags='-fno-strict-aliasing -I/usr/local/include'
ccflags ='-fno-strict-aliasing -I/usr/local/include'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
alignbytes=8, usemymalloc=y, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -ldl -lm -lc -lcrypt -lsec
libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'
Locally applied patches:
---
@INC for perl 5.00562:
/tmp/test/install/lib/perl5/5.00562/sun4-solaris
/tmp/test/install/lib/perl5/5.00562
/tmp/test/install/lib/site_perl/5.00562/sun4-solaris
/tmp/test/install/lib/site_perl
.
---
Environment for perl 5.00562:
HOME=/users/home/techdb
LANG (unset)
LANGUAGE (unset)
LD_LIBRARY_PATH=/users/opt/lib:/usr/ccs/lib:/usr/openwin/lib:
LOGDIR (unset)
PATH=/users/opt/bin:/usr/local/bin:/usr/ccs/bin:/sbin:/usr/sbin:/usr/openwin/bin:/usr/bin:/usr/local/bin
PERL_BADLANG (unset)
SHELL=/users/opt/bin/bash
-
[ID 19991025.003] Race condition in devel branch?
by Ulrich Pfeifer