Artifacts Associated With Ticket 3027822fffffffff
Ticket change [dc7b8205c9] (rid 114490) by kjnash on 2010-07-10 15:55:49:
- assignee initialized to: "hobbs"
- cmimetype initialized to: "text/plain"
- comment initialized to:
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) - foundin initialized to: "obsolete: 8.5.8"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "kjnash"
- subsystem initialized to: "20. [interp]"
- title initialized to: "Failure of [expr] with [interp limit] and [vwait]"
- type initialized to: "Bug"
Ticket change [fd815e3423] (rid 108420) by kjnash on 2010-07-10 22:55:49:
- icomment:
File Added - 379703: testInterpLimits.tcl
- login: "kjnash"
- mimetype: "text/plain"
- username: "kjnash"
- icomment:
Add attachment "testInterpLimits.tcl" [c6dc0fed56] (rid 121841) by kjnash on 2010-07-10 22:55:49.
Ticket change [0254b353f9] (rid 258522) by serhiy.storchaka on 2026-10-17 09:30:42:
- foundin changed to: "8.6.18, 9.0.5, 9.1.0"
- icomment:
Still present in 8.6–9.1. The child hits its time limit, the limit handler enters <nowiki>[vwait]</nowiki>, and the child's pending time-limit timer fires there. It runs the limit check again and raises a background error in the busy child, which clobbers the child's interp result. The math function then returns garbage to <nowiki>[expr]</nowiki>. Proposed fix in branch [/timeline?r=time-limit-handler-reentry|time-limit-handler-reentry]: TimeLimitCallback does nothing while the time limit is marked exceeded, i.e. while its handlers are running. The outer check decides, and a new limit re-arms the timer. This also fixes [3048170fff]. Test interp-34.15.
- login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"
Ticket change [0859ff7a6d] (rid 262028) by jan.nijtmans on 2026-11-22 22:54:58:
- assignee changed to: "jan.nijtmans"
- closedate changed to: "2461367.4548478937"
- closer changed to: "jan.nijtmans"
- comment changed to:
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) - icomment:
Merged to [cded168d12|trunk], core-9-0-branch and core-8-6-branch. Many thanks!
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- severity changed to: "Minor"
- status changed to: "Closed"
Ticket change [b7f9e9abf4] (rid 262125) by kjnash on 2026-11-26 01:22:36:
- closedate changed to: "2461370.5573620256"
- closer changed to: "kjnash"
- icomment: "Excellent work - thank you!"
- login: "kjnash"
- mimetype: "text/plain"