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

Bug 362005

Summary: [sftp] SftpFileService#upload hangs if connection is lost
Product: [Tools] Target Management Reporter: Anna Dushistova <anna.dushistova>
Component: RSEAssignee: dsdp.tm.rse-inbox <tm.rse-inbox>
Status: NEW --- QA Contact: Martin Oberhuber <mober.at+eclipse>
Severity: major    
Priority: P3 CC: stryker, vladimir.prus, ymnk
Version: 3.3.1   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on:    
Bug Blocks: 363076    

Description Anna Dushistova CLA 2011-10-25 16:44:08 EDT
Steps to reproduce:
1) Start uploading a file to the remote host;
2) While upload is still in progress, pull out the ethernet cable or shutdown the corresponding network interface(for instance, "ifconfig eth0 down" on Linux).
After that upload hangs(that is expected) and canceling the monitor doesn't help.

It seems like the hang occurs in ChannelSftp.checkStatus, and since it doesn't have a monitor as a parameter, it cannot be canceled.
Comment 1 Atsuhiko Yamanaka CLA 2011-10-26 02:49:45 EDT
I have not checked the internal of RSE yet,
but com.jcraft.jsch.Session#setServerAliveInterval(int interval) 
has been used?
Comment 2 Anna Dushistova CLA 2011-10-26 03:37:57 EDT
No, we don't use this API anywhere from what I know.
Comment 3 Vladimir Prus CLA 2011-10-26 04:00:29 EDT
Another point is that it's not clear that using this API will make cancellation via IProgressMonitor actually work.
Comment 4 Atsuhiko Yamanaka CLA 2011-10-26 04:06:40 EDT
(In reply to comment #3)
> Another point is that it's not clear that using this API will make cancellation
> via IProgressMonitor actually work.

By using that API, such network problems will be detected,
and SftpFileService#upload will be stopped.
Comment 5 Martin Oberhuber CLA 2011-10-27 12:40:56 EDT
I think we put a hardcoded 5 minute alive interval into RSE a while back:

See bug 155026 comment 6
Comment 6 Martin Oberhuber CLA 2011-10-27 12:43:06 EDT
... and we made it use-configurable in bug 218880 .

Please check if using the UI (in the connection wizard : properties) helps.
Comment 7 Vladimir Prus CLA 2011-10-27 12:47:21 EDT
Of course, setting the timeout to 1 second will cause the launch to terminate after 1 second. However, it seems that terminating launch should work regardless of what is the value of the timeout is.
Comment 8 Rob Stryker CLA 2011-12-15 13:30:31 EST
I would like to note that https://bugs.eclipse.org/bugs/show_bug.cgi?id=363076 is a related (most-likely duplicate) bug. Timeouts seem to have no effect whatsoever. It can hang for upwards of 20 minutes. This is reproduceable easily and becomes a huge issue. 

The workspace cannot shut down properly.
Comment 9 Rob Stryker CLA 2011-12-15 13:31:50 EST
I believe this bug is solidly important