eclipse-platform / eclipse.platform.resources

Eclipse Public License 2.0
3 stars 18 forks source link

Error log on shutdown without stack: "Workspace was not properly initialized or has already shutdown" #114

Closed iloveeclipse closed 2 years ago

iloveeclipse commented 2 years ago

After fixing UILockListener via https://github.com/eclipse-platform/eclipse.platform.ui/issues/56 I see now two other errors appearing in the error log if I shutdown Eclipse with a refresh job running.

One of the errors is from resources plugin and has no stack trace. That must be added to understand the issue.

eclipse.buildId=4.24.0.I20220505-1800
org.eclipse.core.resources
Error
Fri May 06 11:42:02 CEST 2022
Workspace was not properly initialized or has already shutdown.

I plan to push a patch.

merks commented 2 years ago

I think in general any jobs running during shutdown encounter a state that is completely chaotic because some bundles are already stopped but the nothing expects to be working with stopped bundles:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=514960

laeubi commented 2 years ago

There is not really a chaotic state at OSGi shutdown, each bundle is stopped in reverse order according to the startlevel but

iloveeclipse commented 2 years ago

@merks : see discussion on https://github.com/eclipse-platform/eclipse.platform.ui/issues/56. This issue is not important as is, but should help understand what's going wrong now, same as https://github.com/eclipse-platform/eclipse.platform.runtime/issues/50 . Something changed recently, so what we see now worries me.

laeubi commented 2 years ago

so what we see now worries me

I confess I'm more worried about the things we don't see ;-)

E.g I think you see this probably now because we have such code in org.eclipse.core.internal.events.BuildManager.getWorkManager():

private WorkManager getWorkManager() {
    try {
        return workspace.getWorkManager();
    } catch (CoreException e) {
        //cannot happen
    }
  //avoid compile error
  return null;
}

Just wanted to quote Murphy's Law here:

Anything that can go wrong will go wrong

(and also in the most worse way)

So probably you just don't see it (what not means this is the part where it happens!), and one better throws an AssertionError() than add a comment that it cannot happen or remove the exception if it is never thrown. But just as an example we assume it previously would triggered a CoreException this code now might fail with a different exception (that is not hidden) just because the exception type is another one.