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

Bug 321442

Summary: Possible DeadLock in RemoteToolsFileStore
Product: [Tools] PTP Reporter: Roland Schulz <roland>
Component: Remote ToolsAssignee: Project Inbox <ptp-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: g.watson
Version: 4.0.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Roland Schulz CLA 2010-07-31 21:30:27 EDT
See below for email exchange for the problem and the possible solution. (Opening bug because I don't have time to work on it at the moment)

That looks like the problem. It shouldn't be the responsibility of the caller to call disconnect though. Connection should really clean up properly if the connection is terminated for some reason. I guess it might be possible to call disconnect() from test(), but I'm not sure what the implications would be.

Greg


On Jul 22, 2010, at 6:09 PM, Roland Schulz wrote:

isOpen calls indirectly org.eclipse.ptp.remotetools.internal.ssh.Connection.test()
This function tests that the session is still open. If it is not anymore (e.g. dropped by remote side) than isOpen is false but no-one has called disconnect. Or am I wrong?

Roland

On Thu, Jul 22, 2010 at 2:42 PM, Greg Watson <g.watson@computer.org> wrote:
If isOpen is false, then either the connection has never been opened, or the connection was closed at some point. If the connection has been closed then the sftpChannelPool should have been cleared, presumably by calling disconnect. If that's not happening, then it seems like there is something wrong with the test for isOpen or the connection close logic. I don't think calling disconnect before connect is the right solution as it just seems to be hiding the other issue.

Greg


Hi Greg, 

I think I found another possible dead-lock. And because it is so easy to introduce new errors with anything related to the recycling of connections and so difficult to test, I would like your opinion on this. 

org.eclipse.ptp.remote.remotetools.core.RemoteToolsFileStore.getExecutionManager(IProgressMonitor) calls open if isOpen is false. org.eclipse.ptp.remotetools.internal.ssh.Connection.connect(AuthToken, String, int, String, int, IProgressMonitor) puts the channels in sftpChannelPool. 
This deadlocks because before the new connection is opened disconnect is not called. Thus sftpChannelPool is still full and it is not possible to add further channels.  

How should we fix this? Is it safe to call disconnect first from connect to clean up any potential left behind entries as e.g. channels in sftpChannelPool. Or should we call disconnect from getExecutionManager if it opening a new connection? 

Roland
Comment 1 Greg Watson CLA 2014-06-09 14:54:46 EDT
Development has moved to JSch provider.