Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > My program dies.

Reply
Thread Tools

My program dies.

 
 
krivenok.dmitry@gmail.com
Guest
Posts: n/a
 
      01-15-2007
Hello All!

Look at the following pseudo-code:

....
....
while(1)
{
while( $client = $server->accept )
{
next if fork;
# Child code here
print "New client\n";

# Arbitrary perl code (work with Oracle via DBI, logging,
request processing, etc)

exit;
}
}
....
....

As you can see this is a part of TCP server.
My server dies after some time
I see message about Oracle critical error in my log (this is the last
message).
It's very strange because all work with Oracle is performed in _child_
process!

I can't understand how can parent process die!
It may happen only if accept dies, since parent process calls only
accept and fork
in its main loop.

Any ideas?

 
Reply With Quote
 
 
 
 
Justin C
Guest
Posts: n/a
 
      01-15-2007
On 2007-01-15, <> wrote:
> Hello All!
>
> Any ideas?


Yeah, post some code.

Justin.

--
Justin C by the sea.
 
Reply With Quote
 
 
 
 
Paul Pluzhnikov
Guest
Posts: n/a
 
      01-16-2007
writes:

> My server dies after some time


And so it should; it has at least 2 bugs (as posted).

> I can't understand how can parent process die!


Hint: what happens when fork fails ?

The reason fork should fail (given your pseudo-code):
from "perldoc -f fork":

If you "fork" without ever waiting on your children, you will
accumulate zombies.

Hint: zombies exhaust your per-user process limit, and kernel
process table.

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
 
Reply With Quote
 
John Bokma
Guest
Posts: n/a
 
      01-16-2007
Paul Pluzhnikov <ppluzhnikov-> wrote:

> Hint: zombies exhaust your per-user process limit, and kernel
> process table.


And they eat the flesh of the living...

--
John Experienced Perl programmer: http://castleamber.com/

Perl help, tutorials, and examples: http://johnbokma.com/perl/
 
Reply With Quote
 
Krivenok Dmitry
Guest
Posts: n/a
 
      01-16-2007

John Bokma wrote:
> Paul Pluzhnikov <ppluzhnikov-> wrote:
>
> > Hint: zombies exhaust your per-user process limit, and kernel
> > process table.


It's impossible.
There is SIGCHLD handler in my code.
ps output doesn't show any zombies.

>
> And they eat the flesh of the living...
>
> --
> John Experienced Perl programmer: http://castleamber.com/
>
> Perl help, tutorials, and examples: http://johnbokma.com/perl/


 
Reply With Quote
 
anno4000@radom.zrz.tu-berlin.de
Guest
Posts: n/a
 
      01-16-2007
Krivenok Dmitry <> wrote in comp.lang.perl.misc:
>
> John Bokma wrote:
> > Paul Pluzhnikov <ppluzhnikov-> wrote:
> >
> > > Hint: zombies exhaust your per-user process limit, and kernel
> > > process table.

>
> It's impossible.
> There is SIGCHLD handler in my code.
> ps output doesn't show any zombies.


The show your code (reduced to a minimum that still exhibits the
problem). Pseudo-code will only give you pseudo-answers.

Anno
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to javac a java program w/ another java program which is w/o a main method cjeffwang@yahoo.com Java 1 10-31-2005 04:25 AM
System program/ Application program ?? Parvsandhu Java 2 07-11-2005 09:08 AM
how to convert a java program to an exe program ola Java 3 02-16-2004 09:42 AM
Calling Java program in another Java program Rey Java 4 12-12-2003 10:18 PM
passing data between Java program and C program--help pipi Java 1 07-21-2003 05:02 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57