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

open STDOUT creates process leak #3802

Open
p5pRT opened this issue Apr 4, 2001 · 2 comments
Open

open STDOUT creates process leak #3802

p5pRT opened this issue Apr 4, 2001 · 2 comments

Comments

@p5pRT
Copy link

p5pRT commented Apr 4, 2001

Migrated from rt.perl.org#6722 (status was 'open')

Searchable as RT6722$

@p5pRT
Copy link
Author

p5pRT commented Apr 4, 2001

From @mjdominus

  while (1) {
  open STDOUT, "| date" or die $!;
  }

There are two bugs here​:

1. The process table fills up with zombies.

2. The program does not die even though the fork() calls are failing.

This version works​:
 
  while (1) {
  open STDOUT, "| date" or die $!;
  close STDOUT;
  }

(The 'date' command is unhappy because the descriptors are in a
tangle, but that is probably not Perl's fault.)

This version also works​:
 
  while (1) {
  open F, "| date" or die $!;
  }

I'm not actually sure this is a Perl bug; it might be something about
unix that I don't appreciate. I'll try to investigate it further.

It also seems to me that we might already have fixed this.

Perl Info

Flags:
    category=core
    severity=medium

Site configuration information for perl v5.6.0:

Configured by mjd at Wed Sep 20 15:34:29 EDT 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.2.16, archname=i586-linux
    uname='linux plover 2.2.16 #97 fri jun 16 19:45:30 pdt 2000 i586 unknown '
    config_args='-Doptimize=-g -des'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='cc', optimize='-g', gccversion=egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
    cppflags='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include'
    ccflags ='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
    libc=/lib/libc-2.1.3.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    


@INC for perl v5.6.0:
    /usr/local/lib/perl5/5.6.0/i586-linux
    /usr/local/lib/perl5/5.6.0
    /usr/local/lib/perl5/site_perl/5.6.0/i586-linux
    /usr/local/lib/perl5/site_perl/5.6.0
    /usr/local/lib/perl5/site_perl
    .


Environment for perl v5.6.0:
    HOME=/home/mjd
    LANG (unset)
    LANGUAGE (unset)
    LC_ALL=POSIX
    LD_LIBRARY_PATH=/lib:/usr/lib:/usr/X11R6/lib
    LOGDIR (unset)
    PATH=/home/mjd/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11/bin:/usr/games:/sbin:/usr/sbin:/usr/local/bin/X11:/usr/local/bin/mh:/data/mysql/bin:/usr/local/bin/pbm:/usr/local/bin/ezmlm:/home/mjd/TPI/bin:/usr/local/teTeX/bin:/usr/local/mysql/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Jan 18, 2005

From @smpeters

[mjd@​plover.com - Wed Apr 04 01​:40​:01 2001]​:

-----------------------------------------------------------------
[Please enter your report here]

    while \(1\) \{
      open STDOUT\, "| date" or die $\!;
    \}

There are two bugs here​:

1. The process table fills up with zombies.

2. The program does not die even though the fork() calls are failing.

This version works​:

    while \(1\) \{
      open STDOUT\, "| date" or die $\!;
      close STDOUT;
    \}

(The 'date' command is unhappy because the descriptors are in a
tangle, but that is probably not Perl's fault.)

This version also works​:

    while \(1\) \{
      open F\, "| date" or die $\!;
    \}

I'm not actually sure this is a Perl bug; it might be something about
unix that I don't appreciate. I'll try to investigate it further.

It also seems to me that we might already have fixed this.

I was able to recreate this on Perl 5.8.5 on OpenBSD.

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

2 participants