#10818: EclLib should allow signals to make LISP code interruptable
--------------------------+-------------------------------------------------
   Reporter:  nbruin      |       Owner:  was                      
       Type:  defect      |      Status:  needs_review             
   Priority:  major       |   Milestone:  sage-4.7                 
  Component:  interfaces  |    Keywords:  lisp ecl signal interrupt
     Author:  Nils Bruin  |    Upstream:  N/A                      
   Reviewer:              |      Merged:                           
Work_issues:              |  
--------------------------+-------------------------------------------------
Changes (by nbruin):

  * status:  needs_work => needs_review
  * work_issues:  investigate ECL interrupt handling =>
  * milestone:  sage-feature => sage-4.7


Comment:

 Apply handlerswap.p2.patch

 Another take on swapping handlers and this one seems to work:
 {{{
 sage: from sage.interfaces.maxima_lib import maxima as max
 sage: max('sum(1/x^2, x, 1, 100000)')
 ^C---------------------------------------------------------------------------
 [...]
 TypeError: ECL says: Console interrupt
 sage: #we press Ctrl-C again
 KeyboardInterrupt
 }}}
 For reference, ECL prefers to use sigaction (in fact, probably sage should
 be using sigaction as well. Certain race conditions with signal are
 avoidable with sigaction). In glibc, signal is implemented via sigaction
 anyway. sigaction has a richer interface, so signal cannot always properly
 report what sigaction has done. By using sigaction to record and swap the
 different SIGINT handlers, it seems to work.

 Subtle race conditions still exist: the ECL handler is instated just
 before entering lisp code and setting up the "unwind-protect stack frame",
 so an interrupt that gets delivered in that window would cause unspecified
 behaviour. By running

 while True: os.kill(<PID>,2)

 it is easy to trigger such behaviour, but sage in its present state
 already cannot handle this.
 Therefore, I think the present patch establishes acceptable "best effort"
 behaviour.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10818#comment:4>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to