guile-devel
[Top][All Lists]
Advanced

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

Re: Writing to socket after shutdown


From: Andy Wingo
Subject: Re: Writing to socket after shutdown
Date: Thu, 26 Aug 2010 16:24:37 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Hi Jon,

On Mon 02 Aug 2010 22:03, Jon Herron <address@hidden> writes:

>   I had an issue with a program recently where I tried to write to a socket 
> that 
> had been shutdown for transmission. This ends up causing guile to halt 
> without 
> any warning - no exceptions or backtrace available that I can see. I am using 
> guile compiled from master, but get the same results with 1.8.7. Is it 
> correct 
> to assume that I should be able to catch an exception under this 
> circumstance? 

I pasted your example at the REPL run via meta/gdb-uninstalled-guile and
got a SIGPIPE:

   Sent request...
   Shutdown socket for sending...

   Program received signal SIGPIPE, Broken pipe.
   0x000000324e40e42d in write () from /lib64/libpthread.so.0
   (gdb) c
   Continuing.
   Caught exception...
   system-error
   (fport_write ~A (Broken pipe) (32))
   scheme@(guile-user)> 

But the same thing does not work when run at a normal (not in GDB)
REPL. Hmm.

I think SIGPIPE is the right thing to do here; the problem is that Guile
does not appear to catch it by default. I'm not sure why the with-gdb
case is different from the normal case. Indeed adding the following line
does make it work:

  (sigaction SIGPIPE (lambda args (error "got a sigpipe, yo")))

Now, I guess the question is, what should happen when Guile gets a
signal? Should Guile install a signal handler by default? The current
situation is not particularly intuitive.

Andy
-- 
http://wingolog.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]