Re: GIOChannels



On Fri, Jul 08, 2005 at 03:40:15PM -0400, Jon Oberheide wrote:
> Greetings,
> 
> I have a client and server architecture that communicates using
> GIOChannels.  When the client is connected to the server and then
> suddenly killed (via a kill -9 or some other signal that does not hang
> up the connection gracefully), it apparently spews out additional data
> over the socket before it dies.  Is there any way to prevent this?


signals are handled by kernel space code before they're passed on to the
user space code.  in the case of sig-9, the user space code never gets
to run again, so the user space code cannot push any more data into any
pipes or do anything to cancel data that was already sent.  the data you
see delivered on reading end had already been pushed into the pipe by
the time the processes was killed, and was just sitting in a kernel
space buffer waiting to be read.  so...  no, you can't really do
anything about it.  besides something like checking to see if the
sending process is still running, or maybe introducing data integrity
bits to the protocol in use...  like checksums or data chunk sizes with
sync bytes or something even MORE gruesome.  ;)  designing for graceful
handling of sig-9 is not easy.  heh.

- Ben



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]