Home » Modeling » GMF (Graphical Modeling Framework) » Deadlock eclipse UI startup and DiagramUIPlugin activation from builder
Deadlock eclipse UI startup and DiagramUIPlugin activation from builder [message #234616] |
Wed, 24 June 2009 15:02  |
Eclipse User |
|
|
|
My Builder (for a GMF diagram) ends up driving a synchronous requirement
on the UI thread by DiagramUIPlugin (thereby calling Display.syncExec())
while the class loader monitor is held.
But, immediately after eclipse startup, the UI thread is still loading
a lot of classes because its actively loading/restoring open editors
from last run of the workbench. It therefore can't service the UI thread
requirement and is waiting for the class loader monitor.
Its pretty clearly a traditional deadlock due to syncExec() while holding
the class loader monitor, but I'm at a loss what the best fix/workaround
might be that I can do in my plugin/application.
Activate my plugin at startup perhaps?
Cany recommendations?
Thread [main] (Suspended)
owns: RunnableLock (id=72)
waiting for: DefaultClassLoader (id=73)
owned by: Thread [Worker-1] (Suspended)
ClasspathManager.findLocalClass_LockClassLoader(String,
ClassLoadingStatsHook[]) line: 442
ClasspathManager.findLocalClass(String) line: 423
DefaultClassLoader.findLocalClass(String) line: 193
BundleLoader.findLocalClass(String) line: 370
BundleLoader.findClassInternal(String, boolean, ClassLoader) line: 446
BundleLoader.findClass(String, boolean) line: 399
BundleLoader.findClass(String) line: 387
DefaultClassLoader.loadClass(String, boolean) line: 87
DefaultClassLoader(ClassLoader).loadClass(String) line: 597
BundleLoader.loadClass(String) line: 315
BundleHost.loadClass(String, boolean) line: 227
BundleHost(AbstractBundle).loadClass(String) line: 1274
EquinoxRegistryStrategy(RegistryStrategyOSGI).createExecutab leExtension(RegistryContributor,
String, String) line: 160
ExtensionRegistry.createExecutableExtension(RegistryContribu tor, String,
String) line: 867
ConfigurationElement.createExecutableExtension(String) line: 243
ConfigurationElementHandle.createExecutableExtension(String) line: 51
WorkbenchPlugin.createExtension(IConfigurationElement, String) line: 259
EditorDescriptor.getEditorMatchingStrategy() line: 620
EditorManager.findEditors(List, IEditorInput, String, int, List) line:
486
EditorManager.findEditors(IEditorInput, String, int) line: 436
EditorManager.findEditor(String, IEditorInput, int) line: 399
EditorManager.findEditor(IEditorInput) line: 381
WorkbenchPage.findEditor(IEditorInput) line: 2063
EditorUtility.isOpenInEditor(Object) line: 126
DDQBLinkHelper.activateEditor(IWorkbenchPage, IStructuredSelection) line:
118
LinkEditorAction$1.runInUIThread(IProgressMonitor) line: 72
UIJob$1.run() line: 94
RunnableLock.run() line: 35
UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 133
Display.runAsyncMessages(boolean) line: 3800
Display.readAndDispatch() line: 3425
Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2384
Workbench.runUI() line: 2348
Workbench.access$4(Workbench) line: 2200
Workbench$5.run() line: 495
Realm.runWithDefault(Realm, Runnable) line: 288
Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 490
PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149
IDEApplication.start(IApplicationContext) line: 113
EclipseAppHandle.run(Object) line: 193
EclipseAppLauncher.runApplication(Object) line: 110
EclipseAppLauncher.start(Object) line: 79
EclipseStarter.run(Object) line: 386
EclipseStarter.run(String[], Runnable) line: 179
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 79
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
Method.invoke(Object, Object...) line: 618
Main.invokeFramework(String[], URL[]) line: 549
Main.basicRun(String[]) line: 504
Main.run(String[]) line: 1236
Main.main(String[]) line: 1212
Thread [Worker-1] (Suspended)
owns: DefaultClassLoader (id=73)
UISynchronizer.syncExec(Runnable) line: 165
Display.syncExec(Runnable) line: 4251
ColorConstants$SystemColorFactory.getColor(int) line: 29
ColorConstants$SystemColorFactory.access$0(int) line: 23
ColorConstants.<clinit>() line: 51
J9VMInternals.initializeImpl(Class) line: not available [native method]
J9VMInternals.initialize(Class) line: 196
AppearancePreferencePage.initDefaults(IPreferenceStore) line: 223
DiagramUIPlugin.initializeDefaultDiagramPreferenceStore() line: 95
DiagramUIPlugin.start(BundleContext) line: 76
BundleContextImpl$2.run() line: 1009
AccessController.doPrivileged(PrivilegedExceptionAction<T>) line: 246
BundleContextImpl.startActivator(BundleActivator) line: 1003
BundleContextImpl.start() line: 984
BundleHost.startWorker(int) line: 346
BundleHost(AbstractBundle).start(int) line: 265
SecureAction.start(Bundle, int) line: 400
EclipseLazyStarter.postFindLocalClass(String, Class, ClasspathManager)
line: 111
ClasspathManager.findLocalClass(String) line: 427
DefaultClassLoader.findLocalClass(String) line: 193
BundleLoader.findLocalClass(String) line: 370
SingleSourcePackage.loadClass(String) line: 33
BundleLoader.findClassInternal(String, boolean, ClassLoader) line: 443
... Much more class loading stuff. My builder uses my plugin preference
... to determine if full or partial validation occurs.
DefaultClassLoader(ClassLoader).loadClass(String) line: 597
DlaDiagramBuilder.buildDiagram(IFile) line: 322
DlaDiagramBuilder.visit(IResourceDelta) line: 167
ResourceDelta.accept(IResourceDeltaVisitor, int) line: 68
ResourceDelta.accept(IResourceDeltaVisitor, int) line: 79
ResourceDelta.accept(IResourceDeltaVisitor, int) line: 79
ResourceDelta.accept(IResourceDeltaVisitor, int) line: 79
ResourceDelta.accept(IResourceDeltaVisitor, int) line: 79
ResourceDelta.accept(IResourceDeltaVisitor, int) line: 79
ResourceDelta.accept(IResourceDeltaVisitor) line: 48
DlaDiagramBuilder.incrementalBuild(IResourceDelta) line: 110
DlaDiagramBuilder.build(int, Map, IProgressMonitor) line: 70
BuildManager$2.run() line: 633
SafeRunner.run(ISafeRunnable) line: 37
BuildManager.basicBuild(int, IncrementalProjectBuilder, Map, MultiStatus,
IProgressMonitor) line: 170
BuildManager.basicBuild(IProject, int, ICommand[], MultiStatus,
IProgressMonitor) line: 201
BuildManager$1.run() line: 253
SafeRunner.run(ISafeRunnable) line: 37
BuildManager.basicBuild(IProject, int, MultiStatus, IProgressMonitor)
line: 256
BuildManager.basicBuildLoop(IProject[], IProject[], int, MultiStatus,
IProgressMonitor) line: 309
BuildManager.build(int, IProgressMonitor) line: 341
AutoBuildJob.doBuild(IProgressMonitor) line: 140
AutoBuildJob.run(IProgressMonitor) line: 238
Worker.run() line: 55
|
|
|
Re: Deadlock eclipse UI startup and DiagramUIPlugin activation from builder [message #234686 is a reply to message #234616] |
Thu, 25 June 2009 09:52  |
Eclipse User |
|
|
|
After some various failures (that seemed like the more correct
approaches),
I seem to have a hackish sort of workaround.
Its not a good general solution, but it avoids the
problem with the class loader lock and syncExec() in a secondary thread
deadlocking with the UI thread that is loading classes.
1) I set my diagram editor plugin to auto start, implementing
IStartup, and providing an empty earlyStartup() method.
2) In the static initializer for the plugin, I put the code from
DiagramUIPlugin that initialized the preferences pages that the
DiagramUIPlugin also initializes.
The result is that the initial thread that's doing workbench startup
loads all of the classes involved in the deadlock so that the secondary
thread never (for these classes) is required to dynamically load them
or get the class loader lock.
It works, but, yuck, there's no reason the same deadlock can't happen
for other classes or reasons.
Does anyone else have any better suggestions or comments?
|
|
|
Goto Forum:
Current Time: Tue Jul 08 01:10:46 EDT 2025
Powered by FUDForum. Page generated in 0.03900 seconds
|