Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 04-13-2010, 04:27 AM   #1
LQ Newbie
Registered: Apr 2010
Distribution: CentOS
Posts: 7

Rep: Reputation: 0
Perl script dieing while waiting on select() for some response from another exe


I am writing a perl script where forking a child and the child is waiting for some response from C++ exe. Here is the code snippet:

my $retPid = fork;
if ($retPid)
  # I am parent
  # Install signal handler 
  # sleep for a week (6 hours at a time)
  for ($cnt = 0; $cnt < 28 ; $cnt++)
    select(undef, undef, undef, 21600);

    last if ( ! -e "/proc/$retPid" );
  # I am child
  ($iid, $rc, %data) = $cpp_exe->getResponse(604800);  # 1 week timeout
If the cpp_exe takes very long time (around 30 hours) to respond then the perl script (both parent and child) is dieing. The SIG{CHLD} handler defined in parent is not getting called. It seems parent is dieing first then child is dieing (or may be both dieing at the same time).

Any thoughts why the script is dieing?

Thanks in advance.
Old 04-22-2010, 02:56 AM   #2
LQ Newbie
Registered: Apr 2010
Distribution: CentOS
Posts: 7

Original Poster
Rep: Reputation: 0
The perl script is called from a cgi script. So the owner of the perl processes is apache. Is there any chance that apache is sending some signal to its child processes and that is causing the perl script to die.

Does Apache send SIGHUP while managing its process groups? Can there be any relation between the Apache managing its process groups and Perl script dieing?


perl, scripting

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
dhcpcd timing out waiting for server response theofb Linux - Newbie 2 09-15-2008 08:43 AM
Perl Script to select common lines in two files. perluser59 Programming 12 05-26-2008 02:19 AM
how to use perl.exe in shell script littletransformer Programming 7 12-03-2007 03:14 AM
Perl script/mysql select query from a file mcdrr Programming 12 06-05-2007 12:00 AM
tor - waiting for response noir911 *BSD 1 06-29-2006 06:33 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:57 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration