Event loop and http::geturl

Liste des GroupesRevenir à cl tcl 
Sujet : Event loop and http::geturl
De : jonkelly (at) *nospam* fastmail.fm (Jonathan Kelly)
Groupes : comp.lang.tcl
Date : 23. Jun 2025, 21:55:45
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <103cf0h$1glgk$1@dont-email.me>
User-Agent : Mozilla Thunderbird
This is related to my other "too many nested evaluations".
I have taken a snapshot of my apache logs that caused the "..too many nested evaluations" and stripped down my program a bit so I could try and track down what was going on.
So, it looks like ::http::geturl is operating asynchronously, despite my program NOT using -command.
In the log I'm seeing:
----------------------
A before do_get_abuse 132.226.122.74 and ::last_ip is ##
do_get_abuse 132.226.122.74
get_abuse 132.226.122.74
    get_abuse 132.226.122.74 before geturl
A before do_get_abuse 132.226.122.74 and ::last_ip is ##
----------------------
The "A before ..." line is coming from the proc checkForError that is attached to the fileevent
   set ::accessLog [open "|cat access_test.log" r]
   fconfigure $::accessLog -blocking 0 -buffering line
   fileevent $::accessLog readable [list checkForError $::accessLog]
checkForError eventually calls do_get_abuse
proc do_get_abuse {ip} {
   log "do_get_abuse $ip"
   if { [catch {get_abuse $ip} result] } {
     puts "get_abuse failed ... $result"
     exit
   }
}
and in get_abuse I have
   log "   get_abuse $ip before geturl"
   set token [::http::geturl ${url}?${query} -method GET -headers $headers]
   log "   get_abuse $ip  after geturl"
It never gets to the "log get_abuse $ip after geturl", which it should BEFORE the next fileevent readable event is processed.
This is at least contrary to the man page. From the man page:
The ::http::geturl command blocks until the operation completes, unless the -command option specifies a callback that is invoked when the HTTP transaction completes.
I'm going to start building a slow-ish webpage on one of our servers to investigate further with a minimal program.
Hopefully, someone on the guru team could check the http::geturl code?
Thanks
Jonathan.

Date Sujet#  Auteur
23 Jun 25 * Event loop and http::geturl17Jonathan Kelly
23 Jun 25 +- Re: Event loop and http::geturl1Jonathan Kelly
24 Jun 25 `* Re: Event loop and http::geturl15Rich
24 Jun 25  `* Re: Event loop and http::geturl14Jonathan Kelly
25 Jun 25   `* Re: Event loop and http::geturl13et99
25 Jun 25    `* Re: Event loop and http::geturl12et99
25 Jun 25     `* Re: Event loop and http::geturl11et99
25 Jun 25      `* Re: Event loop and http::geturl10Jonathan Kelly
25 Jun 25       `* Re: Event loop and http::geturl9Rich
26 Jun 25        `* Re: Event loop and http::geturl8et99
26 Jun 25         +* File processing (was Event loop and http::geturl)2Alan Grunwald
26 Jun 25         i`- Re: File processing (was Event loop and http::geturl)1Ralf Fassel
26 Jun 25         `* Re: Event loop and http::geturl5Rich
26 Jun 25          `* Re: Event loop and http::geturl4Jonathan Kelly
26 Jun 25           `* Re: Event loop and http::geturl3et99
27 Jun 25            `* Re: Event loop and http::geturl2Christian Gollwitzer
27 Jun 25             `- Re: Event loop and http::geturl1Ralf Fassel

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal