Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 362288 - BundleStatusException when using sqltools.editor.core Plug-In (Deadlock?)
Summary: BundleStatusException when using sqltools.editor.core Plug-In (Deadlock?)
Status: RESOLVED FIXED
Alias: None
Product: Data Tools
Classification: Tools
Component: SQLDevTools (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.10   Edit
Assignee: Brian Payton CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-28 06:03 EDT by Florian Albrecht CLA
Modified: 2012-05-31 17:09 EDT (History)
1 user (show)

See Also:


Attachments
Test project producing the bug (5.00 KB, application/zip)
2011-10-28 06:06 EDT, Florian Albrecht CLA
no flags Details
Proposed patch to remove deadlock (2.52 KB, patch)
2011-11-11 06:09 EST, Florian Albrecht CLA
bpayton: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Albrecht CLA 2011-10-28 06:03:51 EDT
Build Identifier: 20100617-1415

When using the org.eclipse.datatools.sqltools.editor.core Plug-In in a non-GUI application, a BundleStatusException occurs when executing that application. After investigating in the code, it looks pretty much like a deadlock in the init() code of the SQLDevToolsConfigRegistryImpl class (it is quite confusing code, by the way - why doing all this stuff in anonymous threads?).


Reproducible: Always

Steps to Reproduce:
1. Create an empty Plug-In project depending only on org.eclipse.core.runtime and org.eclipse.datatools.sqltools.editor.core. Add an application which only calls ProfileUtil.getProfiles(). I will attach an example project.

2. Create a run configuration (as "Eclipse Application") which executes this application and add only required plug-ins. 

3. Run this application.
Comment 1 Florian Albrecht CLA 2011-10-28 06:06:21 EDT
Created attachment 206122 [details]
Test project producing the bug

Here is the test project. Create a run configuration as described above to reproduce the bug.
Comment 2 Florian Albrecht CLA 2011-11-11 06:09:14 EST
Created attachment 206835 [details]
Proposed patch to remove deadlock

Okay, as nobody seems to care, here is a patch proposal. I still don't know why the listener calls are threaded, but maybe there is database work or similar to be expected. 
Anyway, I added tool code which waits for the EditorCorePlugin to startup if it is still starting. This tool code is called by the listener notification threads, so deadlock situations for the Eclipse Classloader should not occur anymore.
Comment 3 Brian Payton CLA 2012-01-24 16:20:45 EST
Sorry for the lack of response.  The original code for this plugin was contributed by Sybase, and the Sybase committers disappeared when Sybase withdrew from open source activities a couple of years ago.

I'll take a look at the patch, but I don't know this part of the code very well.
Comment 4 Brian Payton CLA 2012-05-17 21:34:56 EDT
The fix looks OK as far as I can tell.  I did some basic testing didn't see any new problems.  I've checked the change into DTP 1.10.  Here's the Git commit record:
http://git.eclipse.org/c/datatools/org.eclipse.datatools.sqltools.git/commit/?id=8d103b6c9c55e5ad6aa0e7019cbcef20c19e3173