Tcl Source Code

View Ticket
Login
Ticket UUID: 2035893
Title: can NRE break limits and script cancellation?
Type: Bug Created on: 2008-08-02 12:25:01
Submitter: msofer Assigned to: msofer
Subsystem: 45. Parsing and Eval Severity:
Priority: 8 Last modified: 2009-05-12 22:43:16
Status: Open Closed by:
Resolution: None Closed on:
Version: obsolete: 8.6a1
Description:
Understand and makes sure that NRE, and in particular the ability to run arbitrary code in the callbacks, did not open gaping holes in those mechanisms. 

If it did, FIX it.
User Comments:
dkf added on 2009-03-25 16:14:58:
What they can't do is run arbitrary Tcl code (at least for limits) since they'll hit the traps again.

mistachkin added on 2009-03-25 17:19:14:
I do not understand NRE well enough yet to know if it can somehow bypass script cancellation.  Are there specific things to look for (e.g. perhaps, things that are not covered by the current tests)?

msofer added on 2009-05-12 22:43:16:
The issue is: during cancellation every callback is run - necessary for cleanup. If a callback launches a new evaluation, it will not run (as the intrep is marked as being cancelled or beyond its limits). If a callback launches some long-running or cpu-eating C code ... cancellation is postponed until it returns! 

Not too different from what would happen if you try to cancel or pass a limit while running some C code. The one diff is: the first scenario will not cancel until a return to Tcl happens; in the new scenario Tcl thinks it has already cancelled before bad stuff happens.

So the new problem is: we now have a new way for a C extension to refuse being cancelled!