Click here to get back home

child process dying if syswrite fails?

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
child process dying if syswrite fails? Konstantinos Agouros 03-28-2008
Posted by Konstantinos Agouros on March 28, 2008, 11:36 am
Please log in for more thread options
Hi,

I encountered a strange problem. I have an application that has a few
sockets open. To notify the other side that I am 'finished' I do a
shutdown on the socket. Because I am lazy I do a syswrite on the socket
after the shutdown which of course fails. However I found that the whole
childprocess doing this dies if I do the syswrite. This used not to happen.
The whole thing is on Gentoo Linux using perl 5.8.8.

Anybody can comment on this?

Regards,

Konstantin
--
Dipl-Inf. Konstantin Agouros aka Elwood Blues. Internet: elwood@agouros.de
Otkerstr. 28, 81547 Muenchen, Germany. Tel +49 89 69370185
----------------------------------------------------------------------------
"Captain, this ship will not survive the forming of the cosmos." B'Elana Torres

Posted by Ben Morrow on March 28, 2008, 11:56 am
Please log in for more thread options

>
> I encountered a strange problem. I have an application that has a few
> sockets open. To notify the other side that I am 'finished' I do a
> shutdown on the socket. Because I am lazy I do a syswrite on the socket
> after the shutdown which of course fails. However I found that the whole
> childprocess doing this dies if I do the syswrite. This used not to happen.
> The whole thing is on Gentoo Linux using perl 5.8.8.

If you write to a socket (or pipe) which is closed, your process will be
sent SIGPIPE. The default action for SIGPIPE is to terminate the
process: this is useful in pipelines when the reading process exits
early. You can ignore this signal, in which case the write will fail
with EPIPE instead.

Ben


Posted by Konstantinos Agouros on March 29, 2008, 4:56 am
Please log in for more thread options


>>
>> I encountered a strange problem. I have an application that has a few
>> sockets open. To notify the other side that I am 'finished' I do a
>> shutdown on the socket. Because I am lazy I do a syswrite on the socket
>> after the shutdown which of course fails. However I found that the whole
>> childprocess doing this dies if I do the syswrite. This used not to happen.
>> The whole thing is on Gentoo Linux using perl 5.8.8.

>If you write to a socket (or pipe) which is closed, your process will be
>sent SIGPIPE. The default action for SIGPIPE is to terminate the
>process: this is useful in pipelines when the reading process exits
>early. You can ignore this signal, in which case the write will fail
>with EPIPE instead.
Indeed I did not ignore this signal. Strange that the same code used to
work before but thanks for the explanation.

Konstantin

>Ben

--
Dipl-Inf. Konstantin Agouros aka Elwood Blues. Internet: elwood@agouros.de
Otkerstr. 28, 81547 Muenchen, Germany. Tel +49 89 69370185
----------------------------------------------------------------------------
"Captain, this ship will not survive the forming of the cosmos." B'Elana Torres

Similar ThreadsPosted
Parent process unable to read messages from child process February 28, 2007, 12:38 pm
Parent process unable to read messages from child process February 28, 2007, 12:38 pm
What's happening with the last child process here???? January 10, 2007, 4:34 am
How to kill a forked child process... June 17, 2005, 7:26 pm
sending a kill to child process August 6, 2005, 11:26 am
couldn't create child process: 720003 May 1, 2006, 9:08 am
problem writing to stdin of child process March 14, 2005, 11:10 am
Setting LD_LIBRARY_PATH env variable for child process April 6, 2007, 3:48 pm
Using Win32::Process::Create with multiple child processes. August 30, 2005, 6:03 pm
Backtick call dies in child process inside daemon July 4, 2005, 3:39 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap