develooper Front page | perl.perl5.porters | Postings from October 1999

[Id: 19991025.003] Race condition in devel branch?

Thread Next
Ulrich Pfeifer
October 26, 1999 05:06
[Id: 19991025.003] Race condition in devel branch?
Message ID:
Did not receive that from the list ... 

This is a bug report for perl from,
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

The problem cannot be reproduced on Linux.

Any ideas?

#!/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:
    osname=solaris, osvers=2.6, archname=sun4-solaris
    uname='sunos billy20 5.6 generic_105181-16 sun4u sparc '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
    use64bits=undef usemultiplicity=undef
    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/, 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:

Environment for perl 5.00562:
    LANG (unset)
    LANGUAGE (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About