Schelte Bron - 2008-09-07

Logged In: YES
user_id=37987
Originator: YES

Another race condition happened after switching to passive mode in an attempt to avoid the problem mentioned here. In that case the ftp package frequently throws an uncatchable error if the file does not exist:

can't read "ftp(Start_Time)": no such variable
while executing
"if {$ftp(Start_Time) == -1} {
set ftp(Start_Time) [clock seconds]
}"
(procedure "::ftp::HandleVar" line 5)
invoked from within
"::ftp::HandleVar 0 sock24"

This happens when the control connection is closed, which cleans up the ftp array, before the data connection is closed. Then when the event handler for the data connection fires due to an eof situation it tries to access ftp(Start_Time), which no longer exists.

It looks like some kind of mechanism is needed that can wait for certain events on the data connection before proceeding.