Bug 205261 - [ftp] ftp upload gets stuck sometimes, and might even hang the UI
Summary: [ftp] ftp upload gets stuck sometimes, and might even hang the UI
Status: NEW
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 2.0.1   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: dsdp.tm.rse-inbox CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords:
Depends on: 180965 227207 205297 228230
Blocks:
  Show dependency tree
 
Reported: 2007-10-02 23:17 EDT by Michael Scharf CLA
Modified: 2012-11-19 04:44 EST (History)
2 users (show)

See Also:


Attachments
full stackrace of the hanging ftp upload (29.89 KB, text/plain)
2007-10-02 23:17 EDT, Michael Scharf CLA
no flags Details
my config log (901.55 KB, text/plain)
2007-10-03 11:03 EDT, Michael Scharf CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Scharf CLA 2007-10-02 23:17:05 EDT
Created attachment 79612 [details]
full stackrace of the hanging ftp upload

I tried to upload a file to a remote ftp site and the transfer got stuck in the main thread, which totally blocks the UI. 

After 10 minutes of waiting, I disable my network connection on windows to get a timeout on the socket (because I hate to kill eclipse, especially when I have unsaved changes). 

I was using 2.0.1.v20070816 of the ftp subsystem
Comment 1 Martin Oberhuber CLA 2007-10-03 10:45:58 EDT
Michael please check your configuration again, and attach a config log (from Help > About > Configuration Details, Copy & Paste)

Your Thread Dump seems to indicate an old version of FTP -- Looking at the main thread, FTPService:line 717 should be in upload(), but in the version included with TM 2.0.1 this is in internalFetch()
Comment 2 Michael Scharf CLA 2007-10-03 11:03:16 EDT
Created attachment 79640 [details]
my config log
Comment 3 Martin Oberhuber CLA 2007-10-03 11:43:25 EDT
Hm... your config seems to be at 2.0.1 RC2 level:
   org.eclipse.rse.services.files.ftp (2.0.1.v20070914) "RSE FTP Service"
   org.apache.commons.net (1.4.1.v200709121930) "Apache Jakarta Commons Net" 

This would mean, that the known FTP deadlock issues should have been resolved already (bug 192610, bug 199243 and bug 203306 on FTP; bug 202758 on commons net). You just don't have the most recent changes for encoding support, which should not influence stability of FTP.

I notice from the thread dump that upload is called on the main thread; this should not happen, and I filed bug 205297 to get this fixed.

Other than that, I cannot find a deadlock or programming error in the thread dump. It seems that during upload(), the OutputStream is simply blocked on write, and I don't know why that could happen; it should at least time out after some time.

Javier can you check if you find anything suspicious, or what the timeout for write through commons net should be?
Comment 4 Michael Scharf CLA 2007-10-03 11:51:17 EDT
I am not complaining about the fact that the write hangs (this can always happen on unreliable networks), nor is there a deadlock, but communication via sockets should *never* happen in the main thread, because it can block the UI. Hanging UI is very annoying, even if there would be a timeout after a few minutes.....
Comment 5 Martin Oberhuber CLA 2007-10-03 11:58:14 EDT
Yes I agree that the Service should never be called on the UI, and I filed bug 205297 for it. Problem is that in the Service we cannot even tell whether we are on the UI thread or not!!

One possibility to alleviate the problem even if bug 205297 were not fixed
might be this - though I'm not sure if monitor.isCanceled() would work properly
when everything is locked up in the dispatch thread:

* Always spawn off a separate thread for upload or download, thereby also
  fixing bug 180965 to allow multiple parallel uploads/downloads

* In the thread that was called from the outside, just update progress monitor
  and check for monitor.isCanceled(); do all that outside the FTP command 
  mutex

* If canceled, kill the upload thread (thereby avoiding hanging thread due to
  network i/o which is not checking for cancel).
Comment 6 Martin Oberhuber CLA 2007-10-18 04:56:43 EDT
I think that now as bug 205297 is fixed for TM 2.0.2, FTP should no longer be called on the dispatch thread so we can reduce severity and change target milestone back to 3.0.
Comment 7 Boris Bokowski CLA 2008-04-15 15:11:39 EDT
Being able to cancel a hung ftp connection would be great!
Comment 8 Martin Oberhuber CLA 2008-09-16 12:39:53 EDT
Bulk update of target milestone
Comment 9 Martin Oberhuber CLA 2010-02-26 19:10:05 EST
Bulk update of target milestones to 3.2
Comment 10 Martin Oberhuber CLA 2011-05-31 17:48:32 EDT
Bulk moving 3.3 deferred items to 3.3.1