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

Bug 329662

Summary: [tcf]IllegalStateException while shutting down Eclipse with unfolded processes/files list
Product: [Tools] TCF Reporter: Anna Dushistova <anna.dushistova>
Component: CoreAssignee: Project Inbox <dsdp.tm.tcf-inbox>
Status: RESOLVED FIXED QA Contact: Martin Oberhuber <mober.at+eclipse>
Severity: normal    
Priority: P3 CC: cdtdoug, eugene
Version: unspecified   
Target Milestone: 1.0.0   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Catching the exception in isConnected() mober.at+eclipse: iplog-

Description Anna Dushistova CLA 2010-11-08 05:52:39 EST
I noticed that an exception is thrown at the moment you shut down Eclipse if you have an unfolded processes list in your connection.The same happens for files subsystem. Here is the stack for processes:
!ENTRY org.eclipse.rse.ui 4 0 2010-11-08 13:47:52.760
!MESSAGE Error disconnecting for org.eclipse.tm.tcf.rse.Processes
!STACK 0
java.lang.IllegalStateException: TCF event dispatcher has shut down
	at org.eclipse.tm.tcf.EventQueue.invokeLater(EventQueue.java:110)
	at org.eclipse.tm.tcf.protocol.Protocol.invokeAndWait(Protocol.java:219)
	at org.eclipse.tm.internal.tcf.rse.TCFConnectorService.isConnected(TCFConnectorService.java:122)
	at org.eclipse.rse.core.subsystems.SubSystem.isConnected(SubSystem.java:2086)
	at org.eclipse.rse.core.subsystems.SubSystemConfiguration.disconnectAllSubSystems(SubSystemConfiguration.java:1478)
	at org.eclipse.rse.ui.RSEUIPlugin.disconnectAll(RSEUIPlugin.java:534)
	at org.eclipse.rse.ui.RSEUIPlugin.stop(RSEUIPlugin.java:506)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:843)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.stop(BundleContextImpl.java:836)
	at org.eclipse.osgi.framework.internal.core.BundleHost.stopWorker(BundleHost.java:474)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.suspend(AbstractBundle.java:546)
	at org.eclipse.osgi.framework.internal.core.Framework.suspendBundle(Framework.java:1098)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.decFWSL(StartLevelManager.java:593)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:261)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.shutdown(StartLevelManager.java:216)
	at org.eclipse.osgi.framework.internal.core.InternalSystemBundle.suspend(InternalSystemBundle.java:266)
	at org.eclipse.osgi.framework.internal.core.Framework.shutdown(Framework.java:685)
	at org.eclipse.osgi.framework.internal.core.Framework.close(Framework.java:583)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.shutdown(EclipseStarter.java:409)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:200)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
Comment 1 Uwe Stieber CLA 2011-04-28 04:05:10 EDT
Created attachment 194241 [details]
Catching the exception in isConnected()

Eclipse does not guarantee an order while shutting down the plug-in's/bundles. In this case, the TCF core plug-in wen't down before the RSE UI plug-in. The most obvious patch for this case, to avoid the exception thrown to the users attention, is to catch it in "TCFConnectorService.isConnected()" (see attached patch).

The more desirable way would be to have a callback like the "startup" extension point, where plug-in's can register and get called back once the TCF core plug-in is shut down. Or extending the "startup" extension point to serve both start and stop. Probably worth a separate enhancement request.
Comment 2 Eugene Tarassov CLA 2011-11-29 13:28:59 EST
I have committed the patch.

> The more desirable way would be to have a callback like the "startup" extension
point, where plug-in's can register and get called back once the TCF core
plug-in is shut down.

Such callback is already provided by OSGi API (e.g. BundleListener). Implementing another one in TCF would be redundant.
Comment 3 Martin Oberhuber CLA 2013-05-23 19:20:39 EDT
Comment on attachment 194241 [details]
Catching the exception in isConnected()

Uwe has been a committer since 2011-09-30 , thus marking attached patch as iplog-