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

Bug 175328

Summary: NPE when disconnecting ssh
Product: [Tools] Target Management Reporter: Martin Oberhuber <mober.at+eclipse>
Component: RSEAssignee: Martin Oberhuber <mober.at+eclipse>
Status: RESOLVED FIXED QA Contact: Martin Oberhuber <mober.at+eclipse>
Severity: normal    
Priority: P2 CC: ddykstal.eclipse
Version: 2.0   
Target Milestone: 2.0   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Martin Oberhuber CLA 2007-02-23 12:32:19 EST
On a fresh workspace, create a new "SSH Only" connection to build.eclipse.org.
Expand the "My Home" node, enter login info so Files is connected.
Select the host node, right-click > disconnect.

I reproducably get the following NullPointerException:

java.lang.NullPointerException
at com.jcraft.jsch.Session.disconnect(Unknown Source)
at org.eclipse.rse.internal.connectorservice.ssh.SshConnectorService.internalDisconnect(SshConnectorService.java:344)
at org.eclipse.rse.core.subsystems.AbstractConnectorService.disconnect(AbstractConnectorService.java:921)
at org.eclipse.rse.core.subsystems.SubSystem.internalDisconnect(SubSystem.java:2647)
at org.eclipse.rse.core.subsystems.SubSystem$DisconnectJob.performOperation(SubSystem.java:1622)
at org.eclipse.rse.core.subsystems.SubSystem$SubSystemOperationJob.run(SubSystem.java:1274)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)


-----------Enter bugs above this line-----------
TM 2.0M5 Testing
installation : eclipse-SDK-3.3M5 (I20070209-1006), cdt-4.0M5, emf-2.3M5
RSE install  : RSE-SDK I20070221-1831 + discovery + remotecdt + efs + tests
java.runtime : Sun 1.4.2_13
os.name:     : Windows XP 5.1, Service Pack 1
------------------------------------------------
systemtype   : Unix-ssh / Linux-dstore (REXEC Launcher)
targetos     : Red Hat Enterprise Linux WS release 4 (Nahant Update 3)
targetuname  : Linux parser.takefive.co.at 2.6.9-34.EL #1 Fri Feb 24 16:44:51 EST 2006 i686 athlon i386 GNU/Linux
targetvm     : Sun Java HotSpot(TM) Client VM (build 1.4.2_13-b06, mixed mode)
------------------------------------------------
Comment 1 Martin Oberhuber CLA 2007-02-23 12:36:02 EST
It's pretty clear that this is actually a jsch bug, because the code checks session.isConnected() before it tries session.disconnect().

Retest once jsch-0.1.31 is available through bug 165432.
Comment 2 Martin Oberhuber CLA 2007-04-04 14:49:49 EDT
*** Bug 181013 has been marked as a duplicate of this bug. ***
Comment 3 Martin Oberhuber CLA 2007-04-04 14:50:33 EDT
I checked with a local copy of Jsch-0.1.31 but the problem is still there. 
The code looks good, so perhaps there is some nasty threading issue involved.
Schedule for fixing with M7.
Comment 4 Martin Oberhuber CLA 2007-05-11 07:57:51 EDT
Fixed in SshConnectorService by checking session.isConnected() inside a synchronized block when notified about disconnect
Comment 5 Martin Oberhuber CLA 2008-08-13 13:18:26 EDT
[target cleanup] 2.0 M7 was the original target milestone for this bug