Prev: How do I check if www site has Perl compatible?
Next: getting results of multiple simultaneous system commands
From: christoph.rabel on 20 May 2010 09:02 Hi! I have inherited a server application which was moved to Linux a couple of weeks ago. Now we see a lot of defunct processes in the process list. Essentially we spawn a new thread for each client. communicate "talks" a while with it and closes the connection afterwards. As it seems, the spawned processes end up as zombies. Can I avoid this behavior easily? Or is ignoring it the best approach? Here is some code to illustrate our approach: (I simplified it slightly, removed some error checking) while (($paddr = accept(CLIENT, SERVER)) || !$time_to_die) { if ($paddr) { my ($port, $iaddr) = sockaddr_in($paddr); my $name = gethostbyaddr($iaddr, AF_INET); my $ip = inet_ntoa($iaddr); logMsg(2, $ip . "(" . $name . "):" . $port . " connected"); spawn (sub { communicate($ip, $port); }); } }
From: Randal L. Schwartz on 20 May 2010 10:22 >>>>> "christoph" == christoph rabel(a)gmail com <christoph.rabel(a)gmail.com> writes: christoph> I have inherited a server application which was moved to Linux a christoph> couple of weeks ago. Now we see a lot of defunct processes in the christoph> process list. Seriously? You didn't think to try the most obvious word in a lookup in the Perl FAQ? $ perldoc -q zombie Found in /usr/local/lib/perl5/5.10.1/pod/perlfaq8.pod How do I avoid zombies on a Unix system? Use the reaper code from "Signals" in perlipc to call wait() when a SIGCHLD is received, or else use the double-fork technique described in "How do I start a process in the background?" in perlfaq8. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <merlyn(a)stonehenge.com> <URL:http://www.stonehenge.com/merlyn/> Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
From: christoph.rabel on 20 May 2010 10:34 On May 20, 4:22 pm, mer...(a)stonehenge.com (Randal L. Schwartz) wrote: > >>>>> "christoph" == christoph rabel(a)gmail com <christoph.ra...(a)gmail..com> writes: > > christoph> I have inherited a server application which was moved to Linux a > christoph> couple of weeks ago. Now we see a lot of defunct processes in the > christoph> process list. > > Seriously? You didn't think to try the most obvious word in a lookup in > the Perl FAQ? Thx. I just inherited the app, I have nothing to do with perl otherwise, I didn't even know that "perldoc" exists. Chris
From: Randal L. Schwartz on 20 May 2010 11:12 >>>>> "christoph" == christoph rabel(a)gmail com <christoph.rabel(a)gmail.com> writes: christoph> Thx. I just inherited the app, I have nothing to do with perl christoph> otherwise, I didn't even know that "perldoc" exists. Then you should either read a tutorial on Perl, or delegate the task to someone who knows Perl. Learning about Perl one fact at a time via a newsgroup is neither effective nor a good use of your time or ours. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <merlyn(a)stonehenge.com> <URL:http://www.stonehenge.com/merlyn/> Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
From: ccc31807 on 20 May 2010 12:05 On May 20, 10:34 am, "christoph.ra...(a)gmail.com" <christoph.ra...(a)gmail.com> > Thx. I just inherited the app, I have nothing to do with perl > otherwise, I didn't even know that "perldoc" exists. This is just a question, no malice or insult intended or implied. I can understand 'inheriting' stuff that you don't want or need or that you don't have anything to do with. I have been in that position, and my children will also probably be in that position with my stuff that they care nothing for. However, 'inheriting' an app carries with it at least a tacit understanding that you have the responsibility for running it and maintaining it, and if the app isn't related to a technology you know, you either migrate it to a technology you do know (e.g., rewrite it in COBOL, Basic, Lisp, or your particular poison) or learn the technology. Question: Will you migrate the app to another technology, learn Perl, or kill the app? I don't think that running it without the ability to maintain it is an option. CC.
|
Next
|
Last
Pages: 1 2 Prev: How do I check if www site has Perl compatible? Next: getting results of multiple simultaneous system commands |