Hi Andy - Thanks for the reply. I think SIGPIPE is indeed the right thing to do. I ended up adding a sighandler to my application and it solved the problem. I suppose it would be nice for Guile to at least display the error on exit - as in the gdb REPL example of yours, if not throw an exception so the user's application can catch. It seems to me the sighandler is more of the C way, where catch/throw is closer to the Scheme way - not sure if that is general consensus or not.
Thanks again for looking at the issue, Jon ----- Original Message ---- From: Andy Wingo <[email protected]> To: Jon Herron <[email protected]> Cc: Guile Devel <[email protected]> Sent: Thu, August 26, 2010 4:24:37 PM Subject: Re: Writing to socket after shutdown Hi Jon, On Mon 02 Aug 2010 22:03, Jon Herron <[email protected]> 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/
