Ok, I think I have a sufficient understanding of what's going on to
suggest the following solution. It "works" for me, though still, my
Tcl is rusty enough that it might be best if this were confirmed by
other members of this list, or even the general Tcl usenet group.
Anyway here goes. With reference to the source code below.
What the author(s) of hv3 seems to have been trying to achieve is to
call the default http::Finish with the 3rd arg always set to 0. The
default http::Finish in the end gets called by the final line
of ::hv3::Finish, the eval/linsert line. But before this is called,
for some reason the author(s) of hv3 saw fit to not only close $state
(sock), but to unset it. This seems to be causing a problem within
the default http::Finish, because it to tries to close $state(sock),
but this results in the error we've been experiencing because it's
already been unset.
So simply commenting out the unset line seems to be the least invasive
solution. What mystifies me is why this is happening for me when I
run the code as a starkit but not the executable. For the time being
I am willing to cross that bridge at another time. Perhaps the
executable is built from slightly different code? But then, I'm
assuming that when states they are experiencing the same problem, they
are running the .exe and not the starkit.
# Declare a wrapper around ::http::Finish
proc ::hv3::HttpFinish {token args} {
upvar 0 $token state
catch {
close $state(sock)
#unset state(sock)
}
eval [linsert $args 0 ::http::FinishReal $token]
}
# Install the wrapper.
rename ::http::Finish ::http::FinishReal