#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: |
--------------------------+-------------------------------------------------
Comment(by nbruin):
Small update:
* Juanjo explains that unwelcome signals in ECL get queued. To mark this
fact, a memory block gets mprotected to readonly. The next time a write
occurs, a SIGSEGV is received and the queued signal is processed if it is
now safe to do so. This means, however, that if ECL is allowed to process
*any* signals then it should be allowed to handle SIGSEGV. So that handler
needs to be swapped as well.
* constants SIGINT and SIGSEGV are now actually imported.
Race conditions still exist. If you run a sage process with pid PID with
something along the lines of
{{{
from sage.libs.ecl import *
lp = ecl_eval("(defun lp (a) (loop))")
while True:
try:
lp(1)
except RuntimeError as e:
print e
}}}
and then run in another process:
{{{
while True:
os.kill(PID,2)
sleep(0.01)
}}}
you may eventually see strange behaviour. To avoid this we could disable
signals prior to swapping the handlers and only enable them once we're
inside lisp (and do the reverse on the way out). However, the signal
handlers in sage are already not completely bullet proof (I don't think
there are many programs where they are). Improvements welcome of course,
but I think the present gives a workable compromise.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10818#comment:5>
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.