Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 334650 - [tests] JUnit test can cause deadlock
Summary: [tests] JUnit test can cause deadlock
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 8.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 8.0   Edit
Assignee: Marc Khouzam CLA
QA Contact: Marc Khouzam CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-18 09:47 EST by Marc Khouzam CLA
Modified: 2011-05-13 11:05 EDT (History)
3 users (show)

See Also:
marc.khouzam: review? (pchuong)


Attachments
Fix (997 bytes, patch)
2011-01-18 09:47 EST, Marc Khouzam CLA
cdtdoug: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Khouzam CLA 2011-01-18 09:47:53 EST
Created attachment 187002 [details]
Fix

I ran into a deadlock when starting the JUnit tests after the Pin&Clone feature was committed.

From what I can see, the JUnit tests run in their own thread and cause the debug plugins to be loaded from that thread.  At the same time, the JUnit tests launch a debug session which requires the UI thread.  The problem is that the ViewIDCounterManager#init() class has started a UI job which requires the debug plugin to be loaded (to access the PinCloneUtils class).  This creates a deadlock.

I'm not sure if the JUnit tests are supposed to start a launch on a different thread than the UI thread, but since it is only affecting the tests, I'm just going to fix it so that it works.

The fix that works is to remove the need for the UI thread from the JUnit test launch by by-passing the preLaunchCheck from the platform.  That check should have been by-passed anyway as it serves no purpose for tests.

The attached patch does this
Comment 1 Marc Khouzam CLA 2011-01-18 09:55:16 EST
Committed the patch to HEAD.
Patrick, can you review?
Comment 2 CDT Genie CLA 2011-01-18 10:23:04 EST
*** cdt cvs genie on behalf of mkhouzam ***
Bug 334650: [tests] JUnit test can cause deadlock

[*] TestLaunchDelegate.java 1.4 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/launching/TestLaunchDelegate.java?root=Tools_Project&r1=1.3&r2=1.4
Comment 3 Patrick Chuong CLA 2011-01-18 10:53:07 EST
Marc, with 334651 fixed. I don't think this is required.
Comment 4 Marc Khouzam CLA 2011-01-18 13:58:55 EST
(In reply to comment #3)
> Marc, with 334651 fixed. I don't think this is required.

You are right.  However, I think the fix makes the JUnit test a little leaner and quicker, so I'd prefer to keep it in in an attempt to have the JUnit test run faster.