Tcl Source Code

View Ticket
Login
Ticket UUID: 3027822
Title: Failure of [expr] with [interp limit] and [vwait]
Type: Bug Version: obsolete: 8.5.8
Submitter: kjnash Created on: 2010-07-10 15:55:49
Subsystem: 20. [interp] Assigned To: hobbs
Priority: 5 Medium Severity:
Status: Open Last Modified: 2010-07-10 22:55:49
Resolution: None Closed By:
    Closed on:
Description:
The example code (in file attachment) starts a slave interpreter and sets a time limit of 2 seconds.  Then it sends the slave into a loop evaluating an [expr] at each iteration.

When the time limit is reached, the master interpreter spends 200ms in the event loop, then renews the slave's [interp limit].  The bug is that when the slave interpreter resumes execution, its state appears to have changed, and the [expr] command fails.

There appear to be no events that could have changed the slave interpreter's state; in any case, such events should not be serviced while the interpreter has exceeded its limits (which includes all the time spent in the event loop).

It is not completely perverse to enter the event loop during an [interp limit] event - one reason would be while posting a dialog to ask the user whether or not to renew a runaway interpreter's limits.

$ tclsh testInterpLimits.tcl
NewSecondsLimit interp0 0.006
NewSecondsLimit interp0 1.864
can't use empty string as operand of "*"
    while executing
"expr {cos($nloop) * sin($nloop)}"
    invoked from within
"interp eval $int1 {
    for {set nloop 0} {$nloop < 10000000} {incr nloop} {
        set result [expr {cos($nloop) * sin($nloop)}]
    }
}"
    (file "testInterpLimits.tcl" line 19)
User Comments: kjnash added on 2010-07-10 22:55:49:

File Added - 379703: testInterpLimits.tcl

Attachments: