Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2026-10-12
17:47 • Closed ticket [2824981fff]: lack of set causes infinite loop through unknown... artifact: f2710ba5a9 user: serhiy.storchaka
2012-01-30
20:43 • Closed ticket [3480592fff]: Houdini escape inf recursion detection plus 7 ot... artifact: 4eee82ea8f user: dkf
2012-01-28
00:07 • Ticket [3480592fff]: 4 changes artifact: 3df4e1922c user: sebres
2012-01-27
23:53 • Ticket [3480592fff]: 4 changes artifact: 86e2692180 user: dgp
23:45 • Ticket [3480592fff]: 4 changes artifact: 69ede1d78f user: dgp
16:37 • New ticket [3480592fff]. artifact: bb0c3a1134 user: dgp

Houdini escape inf recursion detection

Closed / Invalid3480592fffffffffffffffffffffffffffffffffCreated 15 years agoUpdated 15 years ago
Descriptionplain2012-01-27 16:37:51
This demo script creates a busy loop:

proc demo {} {
    catch demo
    demo
}
demo

The guards in Tcl meant to detect and stop infinite
recursion don't catch this one.
dgpplain2012-01-27 23:45:48
It's not necessarily a bug.  Certainly
we permit scripts that hang Tcl:

while 1 {}

It's at least surprising though, since at
least at a simple level we aim to discover
and report infinite recursions.
dgpplain2012-01-27 23:53:17
Aha!  This structure doesn't actually escape
detection.  It just delays it a very very great deal.
The time to detect the recursion is quadratic in
the recursionlimit of the interp.  Use

interp recursionlimit {} 20

before the script, and it will stop with an error.
sebresplain2012-01-28 00:07:24
this is not a busy loop, it's a "tree" of "demo" calls, where in catch each recusrsion level ends level - 1 times with "too many nested evals...". Also factorial from 1000 - is very very big...

IMO - is not a bug.

while 1 {incr test} - is also "busy loop"?
dkfplain2012-01-30 20:43:16
allow_comments - 1

Confirmed as not a bug, just (eye-wateringly) expensive.
Log in (anonymous is fine) to add a comment.