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

Bug 334687

Summary: [tests] Exception thrown at the end of JUnit test session
Product: [Tools] CDT Reporter: Marc Khouzam <marc.khouzam>
Component: cdt-debug-dsf-gdbAssignee: Marc Khouzam <marc.khouzam>
Status: RESOLVED FIXED QA Contact: Marc Khouzam <marc.khouzam>
Severity: normal    
Priority: P3 CC: cdtdoug, pawel.1.piech, pchuong
Version: 8.0Flags: pawel.1.piech: review+
Target Milestone: 8.0   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Fix marc.khouzam: iplog-

Description Marc Khouzam CLA 2011-01-18 13:55:04 EST
Created attachment 187037 [details]
Fix

After the fix to bug 334650, I see the following exception at the end of all the tests.  The exception is issued once for every test that was run.

It turns out that the JUnit tests never actually need any adapters as created by GdbAdapterFactory during their execution.  However, at the very end, when all launches are removed, there is a call to an adapter from PerspectiveManager#launchRemoved.  This call happens right before GdbAdapterFactory#launchesRemoved is called, so we actually try to create all the adapters although the launch is being removed.  And we get a RejectedExecutionException because the executor is no longer valid.

This patch addresses the issue.

!ENTRY org.eclipse.debug.core 4 120 2011-01-18 13:48:43.550
!MESSAGE An exception occurred during launch change notification.
!STACK 0
java.util.concurrent.RejectedExecutionException
	at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.reject(Unknown Source)
	at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(Unknown Source)
	at java.util.concurrent.ScheduledThreadPoolExecutor.schedule(Unknown Source)
	at org.eclipse.cdt.dsf.concurrent.DefaultDsfExecutor.schedule(DefaultDsfExecutor.java:434)
	at java.util.concurrent.ScheduledThreadPoolExecutor.execute(Unknown Source)
	at org.eclipse.cdt.dsf.concurrent.DefaultDsfExecutor.execute(DefaultDsfExecutor.java:458)
	at org.eclipse.cdt.dsf.debug.ui.sourcelookup.DsfSourceDisplayAdapter.<init>(DsfSourceDisplayAdapter.java:615)
	at org.eclipse.cdt.dsf.gdb.internal.ui.GdbAdapterFactory$SessionAdapterSet.<init>(GdbAdapterFactory.java:145)
	at org.eclipse.cdt.dsf.gdb.internal.ui.GdbAdapterFactory.getAdapter(GdbAdapterFactory.java:365)
	at org.eclipse.core.internal.runtime.AdapterManager.getAdapter(AdapterManager.java:326)
	at org.eclipse.core.internal.runtime.AdapterManager.loadAdapter(AdapterManager.java:356)
	at org.eclipse.cdt.dsf.gdb.launching.GdbLaunch.getAdapter(GdbLaunch.java:309)
	at org.eclipse.debug.internal.ui.launchConfigurations.PerspectiveManager.launchRemoved(PerspectiveManager.java:237)
	at org.eclipse.debug.internal.core.LaunchManager$LaunchNotifier.run(LaunchManager.java:443)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.debug.internal.core.LaunchManager$LaunchNotifier.notify(LaunchManager.java:428)
	at org.eclipse.debug.internal.core.LaunchManager.fireUpdate(LaunchManager.java:990)
	at org.eclipse.debug.internal.core.LaunchManager.removeLaunch(LaunchManager.java:2200)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager.removeTerminatedLaunches(LaunchConfigurationManager.java:329)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager.launchAdded(LaunchConfigurationManager.java:315)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager.startup(LaunchConfigurationManager.java:200)
	at org.eclipse.debug.internal.ui.DebugUIPlugin.start(DebugUIPlugin.java:524)
	at [...]
Comment 1 Marc Khouzam CLA 2011-01-18 13:56:14 EST
Committed to HEAD.

Pawel, can you review this two line change?
Comment 2 CDT Genie CLA 2011-01-18 14:23:04 EST
*** cdt cvs genie on behalf of mkhouzam ***
Bug 334687: Adapters could be created once a DsfSession is invalid

[*] GdbAdapterFactory.java 1.18 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/GdbAdapterFactory.java?root=Tools_Project&r1=1.17&r2=1.18
Comment 3 Pawel Piech CLA 2011-01-19 00:41:09 EST
Interesting use case.  The fix makes sense though.