Why do I have to kill?

Chris Jack chris_jack at msn.com
Mon Oct 15 15:54:29 BST 2007

I have a perl program running on Unix that does a fork, runs a process in the child, and exits. If I just let it exit(0) - then the Unix process doesn't die. If I do a kill 15, the child process does go away. I've tried running the Perl debugger on it, but it stops when the parent stops. This thing has a zillion libraries so it's hard to know what else might be effecting it. If I run truss on the process it tells me:
lwp_sema_wait(0x000F5630)       (sleeping...)signotifywait()                 (sleeping...)lwp_sema_wait(0xFDB0DE60)       (sleeping...)lwp_cond_wait(0xFF0DCD30, 0xFF0DCD18, 0x00000000) (sleeping...)
Some relevant lines from the program are:
$pid = fork();if (not defined $pid) { print "resources not available.\n";} elsif ($pid == 0) { print "IM THE CHILD: $$ " . getppid() . "\n"; sleep(1); system('bcp - rest of cmd omitted, but it works.');
print "CHILD finished\n"; # kill 15, $$; exit(0);}else {print "child  pid is $pid\n";print "parent pid is $$\n";print "IM THE PARENT\n";}
I get the "CHILD finished" message, but if I need to uncomment the kill to get the child process to die.
Any ideas anyone?
Celeb spotting – Play CelebMashup and win cool prizes

More information about the london.pm mailing list