Sujet : too many nested evaluations (infinite loop?)
De : jonkelly (at) *nospam* fastmail.fm (Jonathan Kelly)
Groupes : comp.lang.tclDate : 22. Jun 2025, 01:17:31
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <1037i2r$1bp7c$1@dont-email.me>
User-Agent : Mozilla Thunderbird
Hi,
for starters, sorry - long post - but does the following trigger anything with someone that suggests what I should be looking for in my script?
this is running on ubuntu, tcl version 8.6.14.
I have a somewhat complicated script that its scanning lines from my webserver access logs to find bad actors and block them. The main process is a long if then else chain of regexp looking for known attack patterns. The script shuts itself down once a day after midnight, and is restarted by a cron job at 12.15am.
Up to a certain point, it would run without this problem, and now it's coming up at least once a day.
After running for some time it keeps throwing "too many nested evaluations (infinite loop?)" errors- and the places it throws the error from changes.
the script is event based. This is open log file proc
proc openAccessLog {} {
log "[now] Opening log file"
set ::accessLog [open "|tail -f -n 30 /var/log/apache2/access.log" r]
fconfigure $::accessLog -blocking 0 -buffering line
fileevent $::accessLog readable [list checkForError $::accessLog]
#initial run after 2 minutes
after 120000 clearExpired
}
it also runs a couple of event procs like this one
proc stopper {} {
set stop_file "/var/tmp/http.stop"
if {[file exists $stop_file]} {
log "[now] closing"
file delete $stop_file
saveSeen
set ::stop "stop"
} else {
#log "." false
}
after 61000 stopper
}
and FYI,
proc now {} {
clock format [clock seconds] -format {%e/%m/%y %T}
}
a recent error is in this proc:
too many nested evaluations (infinite loop?)
while executing
"ParseFormatArgs {*}$args"
(procedure "::tcl::clock::format" line 6)
invoked from within
"clock format [clock seconds] -format {%e/%m/%y %T}"
(procedure "now" line 2)
invoked from within
"now"
(procedure "stopper" line 4)
invoked from within
"stopper"
("after" script)
Also note this script is using ::http::geturl to talk to external APIs, ("
https://api.abuseipdb.com/api/v2/check")
and i THINK, this is where the problem starts. From the most recent crash, the first error was ...
too many nested evaluations (infinite loop?)
while executing
"variable $token"
(procedure "Finish" line 10)
invoked from within
"Finish $token $msg"
(procedure "::http::Connected" line 231)
invoked from within
"::http::Connected $token $proto $phost $srvurl"
(procedure "http::Connect" line 28)
invoked from within
"http::Connect ::http::250 https {} /api/v2/check?ipAddress=172.192.10.125&maxAgeInDays=30"
thanks
Jonathan.