Tk Library Source Code

View Ticket
Login
Ticket UUID: 3610022
Title: Unprotected close causes script crash
Type: Bug Version: None
Submitter: guitarzar Created on: 2013-04-04 14:58:52
Subsystem: ftp Assigned To: andreas_kupries
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2013-04-05 22:57:59
Resolution: Invalid Closed By: guitarzar
    Closed on: 2013-04-05 15:15:26
Description:
In tcllib /modules/ftp on a line near the end of the ftp.tcl file there is:

close $ftp(SourceCI)

Can you please change this to:

catch {close $ftp(SourceCI)}

to prevent crashes? Thanks!
User Comments: andreas_kupries added on 2013-04-05 22:57:59:
No problem, and glad to hear that you figured it out.
A bug where I have not to do anything is the best kind of bug ;)

guitarzar added on 2013-04-05 22:15:26:

allow_comments - 1

I'm closing this. I think the following was happening: The connection was open, files being transferred, connection was broken by external forces, my app then tried to close the connection but it was already close. This triggered an error. The catch on your close included dumping the error info and we got an odd dump of stuff from a different catch being done in my app that made it look like my app was crashing. I have now utilized your -output option to redirect your output to a proc and I also added clearing the ::errorInfo var to my app so the odd dump is not longer involved. I think this is basically a false alarm. Sorry about that.

andreas_kupries added on 2013-04-05 00:13:21:
Thanks for your support in this.

guitarzar added on 2013-04-05 00:06:21:
Ya, I don't remember what the exact error was. I will change things back to the original state and see if it will fail again. Once I have a log I will upload it.

andreas_kupries added on 2013-04-04 23:37:03:
Hm. The script looks ok. I will try to reproduce this with some fake ftp server and files.

(Note: I am uncomfortable with simply putting in a catch without understanding why the close threw an error. It feels too much like simply plastering over hole without killing the termite which created it).

A pity that you deleted the log already, or I would have asked for the relevant part of it.
Do you remember what the error message was ? (close has several conditions where it can throw an error, with distinctive messages).

guitarzar added on 2013-04-04 23:24:21:
I uploaded a small script which reflects a very minimalized version of what is going on in my program. The program runs in a infinite while loop pausing for 60 seconds then rechecking for new files. The program runs continuously. I had a log with the error in it and unfortunately deleted it. It's actually not hard crashing but instead throws a "error" msg with a trace back to the close statement. Since this trace is really not helpful, as it's not really an error in my code, it seems more reasonable to catch this event and pass a more appropriate error msg and not dump a code trace.

guitarzar added on 2013-04-04 23:17:13:

File Added - 462304: ftp-code-sample.tcl

andreas_kupries added on 2013-04-04 22:50:58:
Is it possible to provide us with a small script demonstrating how to cause the problem, i.e. crash ?

Attachments: