Re: event error catching

Espen S Johnsen <[email protected]> 14 Jul 2006 13:18:43 +0200
Newsgroups gmane.lisp.clg.devel
Message-ID <[email protected]>
Yves Vandriessche <[email protected]> writes:

> Is there a way to 'invalidate' a signal handling function when it raises 
> an error?  At the moment the gtk thread seems to keep pushing errors on 
> sbcl's stack, causing it to crash and burn my slime connection by 
> overflowing the error stack.

This is no doubt a bit nasty and one of those things I have thought
about fixing for a long time.
 
> What would be a 'nice' way to catch these errors and freeze the gtk 
> thread as well as the main sbcl one?  At the moment I'm simply wrapping 
> an ignore-error, but this doesn't exactly help with debugging.

The 'nice' way to do this is to block the faulty handler while in the
debugger, which could be done in the following way:

(let ((handler-id))
  (setq handler-id (signal-connect object 'signal 
                    #'(lambda ()
                        (signal-handler-block object handler-id)
                        (unwind-protect
                            (do-something)
                          (signal-handler-unblock object handler-id))))))

But as doing this manually for every potential faulty handler would be a
bit cumbersome, I have added code that does this automatically for every
handler and also adds a new restart which can be used to disconnect a
handler from the debugger. Note that errors in emission hooks and class
handlers could still cause crashes.

-- 
Espen


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642