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

Hanging on backticks and ulimit -u100 #9447

Open
p5pRT opened this issue Aug 13, 2008 · 4 comments
Open

Hanging on backticks and ulimit -u100 #9447

p5pRT opened this issue Aug 13, 2008 · 4 comments

Comments

@p5pRT
Copy link

p5pRT commented Aug 13, 2008

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

Searchable as RT57908$

@p5pRT
Copy link
Author

p5pRT commented Aug 13, 2008

From memo2005@tlen.pl

Created by memo2005@tlen.pl

Please open a file named "my_program", and write three lines into it​:

#!/usr/bin/perl -w
print STDERR "$$\n";
`./my_program`;

Now open bash and execute command​:

(ulimit -u100; ./my_program)

This program hangs after reaching maximum number of child processes.
My system is​:

  Debian GNU/Linux, 2.6.18-iplus #1 SMP Wed Dec
  12 14​:35​:52 CET 2007 i686 GNU/Linux
  perl, v5.8.8 built for i486-linux-gnu-thread-multi

This bug was discussed here​:

http​://www.perlmonks.com/?node_id=704071

Perl Info

Flags:
    category=core
    severity=high

Site configuration information for perl v5.8.8:

Configured by Debian Project at Fri Apr 25 20:33:47 UTC 2008.

Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
    osname=linux, osvers=2.6.24.4, archname=i486-linux-gnu-thread-multi
    uname='linux ninsei 2.6.24.4 #1 smp preempt fri apr 18 15:36:09 pdt 2008 i686 gnulinux '
    config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=i486-linux-gnu -Dprefix=/usr -Dprivlib=/usr/share/perl/5.8 -Darchlib=/usr/lib/perl/5.8 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.8.8 -Dsitearch=/usr/local/lib/perl/5.8.8 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Dsiteman3dir=/usr/local/man/man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Uusesfio -Uusenm -Duseshrplib -Dlibperl=libperl.so.5.8.8 -Dd_dosuid -des'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include'
    ccversion='', gccversion='4.1.2 20061115 (prerelease) (Debian 4.1.1-21)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    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, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lgdbm -lgdbm_compat -ldb -ldl -lm -lpthread -lc -lcrypt
    perllibs=-ldl -lm -lpthread -lc -lcrypt
    libc=/lib/libc-2.3.6.so, so=so, useshrplib=true, libperl=libperl.so.5.8.8
    gnulibc_version='2.3.6'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    


@INC for perl v5.8.8:
    /etc/perl
    /usr/local/lib/perl/5.8.8
    /usr/local/share/perl/5.8.8
    /usr/lib/perl5
    /usr/share/perl5
    /usr/lib/perl/5.8
    /usr/share/perl/5.8
    /usr/local/lib/site_perl
    .


Environment for perl v5.8.8:
    HOME=/home/memo
    LANG=pl_PL
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
    PERL_BADLANG (unset)
    SHELL=/bin/bash


@p5pRT
Copy link
Author

p5pRT commented Aug 13, 2008

From alexm@cpan.org

Note that "ulimit -u100" works on bash, but may be different in other
shells; e.g. it's "ulimit -p100" in dash (/bin/sh is dash in latest
GNU+Linux distros).

@p5pRT
Copy link
Author

p5pRT commented Aug 14, 2008

From @iabyn

On Wed, Aug 13, 2008 at 10​:08​:26AM -0700, memo2005 wrote​:

Please open a file named "my_program", and write three lines into it​:

#!/usr/bin/perl -w
print STDERR "$$\n";
`./my_program`;

Now open bash and execute command​:

(ulimit -u100; ./my_program)

This program hangs after reaching maximum number of child processes.
My system is​:

Debian GNU/Linux\, 2\.6\.18\-iplus \#1 SMP Wed Dec 
12 14​:35​:52 CET 2007 i686 GNU/Linux
perl\, v5\.8\.8 built for i486\-linux\-gnu\-thread\-multi

This bug was discussed here​:

http​://www.perlmonks.com/?node_id=704071

The behaviour appears intentional​:

util.c​:

  Perl_my_popen(pTHX_ const char *cmd, const char *mode)
  ...
  while ((pid = PerlProc_fork()) < 0) {
  if (errno != EAGAIN) {
  ....
  return NULL;
  }
  sleep(5);
  }

and has been that way since perl 3. Whether the behaviour is desirable, or
needs to be changed or documented, is another matter.

--
I before E. Except when it isn't.

@p5pRT
Copy link
Author

p5pRT commented Aug 14, 2008

The RT System itself - Status changed from 'new' to 'open'

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