Community
Participate
Working Groups
All diagrams call the following snippet in their Activator#start method: > CustomDiagramPreferenceInitializer diagramPreferenceInitializer = new CustomDiagramPreferenceInitializer(); > diagramPreferenceInitializer.initializeDefaultPreferences(); This eventually leads to the initialization of the GMF Appearance preference page, which uses a Display.syncExec() to define a Font. Since the Properties View Configuration can be initialized in a Worker thread, the following steps typically happen when a generated Papyrus Diagram also declares a Properties View configuration: - UI: Open the PropertiesView preference pages - UI: PropertiesView's Activator#start in the UI Thread -- UI: Starts a background Job to load properties view configurations and keep going --- Worker: The background Job starts contributing plug-ins (e.g. Sequence Diagram) in a Worker Thread --- Worker: SequenceDiagram initializes its preferences --- Worker: The preferences eventually delegate to GMF's Appearance PreferencePage, which results in Display.syncExec() -- UI: Waits for the PropertiesView configurations to be loaded to display the preference pages So we have a deadlock between the Diagram's Activator waiting for the UI Thread, and the UI Preference Pages waiting for the Worker Thread to finish loading the properties view configurations In general, it seems very dangerous to synchronously jump to another thread during the activation of a bundle (Directly or indirectly). These calls to initializeDefaultPreferences() should be either: - Done asynchronously (e.g. Display.asyncExec() or a Job) to avoid blocking Activator#start - Done somewhere else (Not in Activator#start, but rather when these preferences are actually required) Since these methods are generated, they affect all diagrams, but are especially visible for the Diagrams that contribute Properties View configurations, since Properties View Configurations are loaded in a background (non-UI) job
This is now blocking my execution of the Papyrus All Tests suite in my Neon API refactorings, because now the OSGi class loader is deadlocking at start-up every time, on activation of the Sequence Diagram plug-in triggered by loading a properties constraint class. These properties constraints are generally pretty simple algorithms and don't, I think, need to trigger lazy bundle activation. Happily, most constraints are already partitioned into separate packages, which makes it easy to exclude them from the lazy activation rule. It just needs this one constraint in the Sequence Diagram to be moved into its own package (it's currently in the utils package, which probably also doesn't need to trigger bundle activation, but I don't want to risk that). Anyways, I have a fix in hand, so I'll take this bug.
New Gerrit change created: https://git.eclipse.org/r/64875
Gerrit change https://git.eclipse.org/r/64875 was merged to [master]. Commit: http://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/commit/?id=933ef683155a709c672ec90c1fe948d54ccaa9cb
Unassigning this bug, as the Gerrit patch relieves some cases of deadlocks (especially in test execution) but doesn't address the root problem of bundle activators doing stuff synchronously on the UI thread.