fork problem (Re: fork or exec thingy.)

Remco van 't Veer (remco@redwood.nl)
Wed, 4 Aug 1999 17:07:32 +0200


On 22 Jul 1999, Terje Malmedal wrote:

> Bash on Linux seems to have problems starting subprocesses
> occasionally, the following program fails randomly:
> --------------------------
> #!/bin/bash

[snip]

> 859primes.sh: Can't reopen pipe to command substitution (fd 4): No child processes /usr/bin/test: argument expected
> /usr/bin/test: argument expected
> primes.sh: Can't reopen pipe to command substitution (fd 4): No child processes /usr/bin/test:
> argument expected
> 877 881 883 887 907 911 919 929 937 941 947 953 967 971 977 983

[snip]

> Machines tested were idle apart from the shellscript, with plenty of
> RAM.

[snip]

I am encountering a similar problem. But I am not having random
fails. Nevertheless I think these problems are related since it
involves fork() on well-equipped hardware.

The machine involved is a 512Mb RAM dual Pentium III (2x450MHz)
running Redhat-6.0. Note: This version of Redhat comes with
linux-2.0.5-15 and glibc-2.1.1. I've tried the SMP and the non-SMP
kernel version Redhat is providing, both fail..

The crashing application is a feature-rich scheduler tightly
integrated with Oracle. It does not show this problem on on
linux-2.0.35 with glibc-2.0.7 and 8 other Unix flavours.

The scheduler crashes when it fork/execs two agents. These agents
connect to the Oracle database by means of the BEQ-protocol (a helper
process is fork/execed by the oracle OCI-library). The last fork()
call returns the child pid to the parent but the child process never
reaches the code after the fork. The child dumps core before that..

Here's a typescript of a gdb session opening the core-file:

(gdb) GNU gdb 4.17.0.11 with Linux support
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
Core was generated by `jcs master agent LX05'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /home/oracle/product/lx815/lib/libskgxp8.so...done.
Reading symbols from /lib/libdl.so.2...done.
Reading symbols from /lib/libm.so.6...done.
Reading symbols from /lib/libpthread.so.0...done.
Reading symbols from /lib/libcrypt.so.1...done.
Reading symbols from /lib/libc.so.6...done.
Reading symbols from /lib/ld-linux.so.2...done.
Reading symbols from /lib/libnss_nisplus.so.2...done.
Reading symbols from /lib/libnsl.so.1...done.
Reading symbols from /lib/libnss_files.so.2...done.
Reading symbols from /lib/libnss_nis.so.2...done.
Reading symbols from /lib/libnss_dns.so.2...done.
Reading symbols from /lib/libresolv.so.2...done.
#0 __pthread_mutex_init (mutex=0x0, mutex_attr=0xbfff8024) at spinlock.h:59
spinlock.h:59: No such file or directory.
(gdb) info stack
#0 __pthread_mutex_init (mutex=0x0, mutex_attr=0xbfff8024) at spinlock.h:59
#1 0x40041950 in __fresetlockfiles () at lockfile.c:83
#2 0x4003fbc8 in fork () at ptfork.c:92
#3 0x80f47cd in rsdmfor ()
#4 0x80ee315 in rsssrsc ()
#5 0x804c129 in main ()
#6 0x40090cb3 in __libc_start_main (main=0x804c040 <main>, argc=2,
argv=0xbffffc84, init=0x804afdc <_init>, fini=0x849879c <_fini>,
rtld_fini=0x4000a350 <_dl_fini>, stack_end=0xbffffc7c)
at ../sysdeps/generic/libc-start.c:78
(gdb)

I am not sure if this is a glibc problem, a kernel problem or a
combination. dmesg shows no related messages.

I hope this input will help people get closer to solving this problem.

Regards,
Remco

PS. please CC replies to me because I am not subscribed to this list..

--
AK-47 Zimmermann BOK security POUM stealth Kosovo Kosto jihad NSA spy
Osama Bin Laden CNT-FAI colonel Mossad World Trade Center DES FBI IRT IDEA

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/