Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 16469

Summary: FTP Passive mode dead-lock
Product: [Eclipse Project] Platform Reporter: Michael Valenta <Michael.Valenta>
Component: TeamAssignee: Michael Valenta <Michael.Valenta>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: 2.0 F3   
Hardware: Other   
OS: other   
Whiteboard:

Description Michael Valenta CLA 2002-05-20 15:28:55 EDT
I sometimes get a deadlock condition when I'm using passive mode and Norton 
Internet Security prompts to allow the connection on the new port.
Comment 1 Michael Valenta CLA 2002-05-20 20:35:36 EDT
I got this again by placing a breakpoint deep in the finish code of the deploy 
wizard. The TimeoutOutputStream#waitUntilDone() seems to be stuck in a wait.
Comment 2 Michael Valenta CLA 2002-05-20 20:39:47 EDT
The above only happens if the connection is blocked!
Comment 3 Michael Valenta CLA 2002-05-20 21:05:19 EDT
Got deadlock again when getting a file in the sync view!
Comment 4 Michael Valenta CLA 2002-05-20 21:18:27 EDT
After a brief investigation, it appears that the problem is due to the fact 
that a workspace operation is run in one thread but file transfers happen in 
another. Since the FTPClient accepts an IFile as a parameter, the 
create/setContents happens in another thread and this seesm to cause the 
deadlock. The solution is to refactor the FTPClient to either 
create/setContents in the callers thread or to return an input stream.

Since the IRemoteResource#getContents requires a stream anyway, the second 
solution is desirable.
Comment 5 Michael Valenta CLA 2002-05-21 17:28:34 EDT
Deadlock on file transfers has been fixed. Still need to check on original 
problem (deadlock on debug and blocking of connection using Norton Intenet).
Comment 6 Michael Valenta CLA 2002-05-21 21:50:47 EDT
It turns out that it's not really dealock. The FTP client eats the exception on 
the failed connection in one thread and gets blocked waiting for a response 
from the server in another thread. Thankfully, the server eventually responds 
that the connection was never made (after about a minute). It's probably best 
to refactor the FTP requests to wait until the auxilary connection is 
established before junping in to read the responses in the main thread.
Comment 7 Kevin McGuire CLA 2002-06-06 15:20:35 EDT
post 2.0, unless you disagree
Comment 8 Michael Valenta CLA 2002-06-06 15:22:36 EDT
I already have a fix for this and I believe it should go in.
Comment 9 Michael Valenta CLA 2002-06-11 10:25:46 EDT
Fixed and verified by James