Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2012-01-28
03:25 • Closed ticket [2914500fff]: bad handling of errors in http::geturl callback ... artifact: 4e8b7c86ba user: kennykb
03:15 • Ticket [2914500fff]: 4 changes artifact: 25f7f14495 user: dvrsn
2009-12-15
00:55 • New ticket [2914500fff]. artifact: c803b86bc1 user: dvrsn

bad handling of errors in http::geturl callback

Closed / Duplicate2914500fffffffffffffffffffffffffffffffffCreated 17 years agoUpdated 15 years ago
Descriptionplain2009-12-15 00:55:36
If an error occurs in a http::geturl callback proc after the token has already been cleaned up, you get a very confusing stack trace.  There is no issue with cleaning up the token in a callback or with raising an error in a callback (although perhaps this case should be reported as a background error), only when the token is cleaned up and then the callback does not complete successfully.

Example:
package require http

proc bgerror {e} {
    puts "bgerror:\n$::errorInfo"
    exit
}

proc handle {tok} {
    http::cleanup $tok
    stupid error  
}   

http::geturl http://www.yahoo.com/ -command handle

set done 0
after 10000 {set done 1}
vwait done

bgerror:
can't read "state(sock)": no such element in array
    while executing
"CloseSocket $state(sock) $token"
    (procedure "Finish" line 12)
    invoked from within
"Finish $token $err"
    (procedure "http::Event" line 154)
    invoked from within
"http::Event sock6 ::http::1"
dvrsnplain2012-01-28 03:15:48
I think this is essentially a dup of 705956 which was fixed a year or so before this was filed, but I might not have used the head code at the time.

In any case, it doesn't seem to be a problem in current releases.
kennykbplain2012-01-28 03:25:30
Since the submitter reports this is no longer an issue, I'm closing it out as a duplicate.
Log in (anonymous is fine) to add a comment.