[Top][All Lists]

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

Re: Writing to socket after shutdown

From: Jon Herron
Subject: Re: Writing to socket after shutdown
Date: Fri, 27 Aug 2010 07:01:19 -0700 (PDT)

Hi Andy -

  Thanks for the reply. I think SIGPIPE is indeed the right thing to do. I 
up adding a sighandler to my application and it solved the problem. I suppose 
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,


----- Original Message ----
From: Andy Wingo <address@hidden>
To: Jon Herron <address@hidden>
Cc: Guile Devel <address@hidden>
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 <address@hidden> writes:

>   I had an issue with a program recently where I tried to write to a socket 
> 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/
   (gdb) c
   Caught exception...
   (fport_write ~A (Broken pipe) (32))

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.



reply via email to

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