Bug 514090 - Investigate whether suspension of JobManager during workbench startup is beneficial or not
Summary: Investigate whether suspension of JobManager during workbench startup is bene...
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.6   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks: 501997
  Show dependency tree
 
Reported: 2017-03-22 17:08 EDT by Mikaël Barbero CLA
Modified: 2020-03-10 12:38 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mikaël Barbero CLA 2017-03-22 17:08:17 EDT
JobManager is suspended during workbench startup preventing the use of the jobs framework during early init stage (e.g. you can't rely on Job.join as it will return immediately even if the job is waiting or waiting, ie not finished). It blocks me from using the job framework in https://git.eclipse.org/r/#/c/73007/.

This suspension has been introduced in 2004 in commit http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=57be9b9142ddec8b1b1cf2a0f68bf028ddf633b6 for no obvious reason. Does anyone know the reason of the suspension? 

In case nobody knows why, I will submit a patch removing it shortly.
Comment 1 Eclipse Genie CLA 2017-03-22 17:13:26 EDT
New Gerrit change created: https://git.eclipse.org/r/93655
Comment 2 Sergey Prigogin CLA 2017-03-22 18:17:13 EDT
Disabling job manager during startup may have positive impact on startup time by reducing resource consumption and class loading during early stages of the startup sequence. In its current form it doesn't achieve this goal since jobs may start running before the job manager is suspended. Suspension of JobManager while jobs are already running is very dangerous since it causes Job.join and JobGroup.join to violate their regular contracts.
 
Complete removal of job manager suspension is quite risky since it has a potential of unmasking many dormant bugs. A safer alternative would be to make sure the the job manager is suspended before the first job is scheduled.
Comment 3 Eclipse Genie CLA 2017-03-22 20:21:19 EDT
New Gerrit change created: https://git.eclipse.org/r/93662
Comment 4 Sergey Prigogin CLA 2017-03-22 20:29:35 EDT
I tried to suspend the job manager early during startup (https://git.eclipse.org/r/93662) and got:

java.lang.ExceptionInInitializerError
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getURIConverter(ResourceSetImpl.java:499)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:369)
	at org.eclipse.e4.ui.internal.workbench.ResourceHandler.getResource(ResourceHandler.java:286)
	at org.eclipse.e4.ui.internal.workbench.ResourceHandler.loadResource(ResourceHandler.java:262)
	at org.eclipse.e4.ui.internal.workbench.ResourceHandler.loadMostRecentModel(ResourceHandler.java:169)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.loadApplicationModel(E4Application.java:378)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:253)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:614)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:145)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1472)
Caused by: java.lang.IllegalStateException: Workspace is closed.
	at org.eclipse.core.resources.ResourcesPlugin.getWorkspace(ResourcesPlugin.java:447)
	at org.eclipse.emf.ecore.plugin.EcorePlugin.getWorkspaceRoot(EcorePlugin.java:1131)
	at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.<clinit>(ExtensibleURIConverterImpl.java:393)
	... 25 more

It looks like the job.join call in ResourcesPlugin.getWorkspace() is unsafe due to the job manager suspension. It looks like the change made in bug 501997 has to be rolled back.
Comment 5 Sergey Prigogin CLA 2017-03-22 20:36:07 EDT
(In reply to Sergey Prigogin from comment #4)
This is the same problem as the one described in https://bugs.eclipse.org/bugs/show_bug.cgi?id=507092#c19
Comment 6 Sergey Prigogin CLA 2017-03-22 23:45:29 EDT
Change https://git.eclipse.org/r/93662 works fine after asynchronous workspace initialization (bug 501997) has been rolled back.
Comment 7 Dani Megert CLA 2017-03-23 09:23:05 EDT
(In reply to Sergey Prigogin from comment #2)
> Complete removal of job manager suspension is quite risky since it has a
> potential of unmasking many dormant bugs. A safer alternative would be to
> make sure the the job manager is suspended before the first job is scheduled.

+1.
Comment 8 Sergey Prigogin CLA 2017-03-23 14:35:25 EDT
I propose that we merge change https://git.eclipse.org/r/93662 that moves suspension of the job manager earlier in the startup sequence. After that the effect of the suspension on the startup time should be investigated and, if there is no noticeable difference, the suspension can be removed soon after the Oxygen release.
Comment 9 Mikaël Barbero CLA 2017-03-24 10:43:18 EDT
(In reply to Sergey Prigogin from comment #8)
> I propose that we merge change https://git.eclipse.org/r/93662 that moves
> suspension of the job manager earlier in the startup sequence. 

Looks good. Thanks Sergey. I'm abandoning mine.
Comment 10 Sergey Prigogin CLA 2017-03-24 13:44:20 EDT
(In reply to Mikaël Barbero from comment #9)
> (In reply to Sergey Prigogin from comment #8)
> > I propose that we merge change https://git.eclipse.org/r/93662 that moves
> > suspension of the job manager earlier in the startup sequence. 
> 
> Looks good. Thanks Sergey. I'm abandoning mine.

Please don't abandon it yet. It still makes sense to investigate if the suspension is beneficial for the startup time or not.
Comment 12 Eclipse Genie CLA 2020-03-10 12:38:11 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.