eclipse-platform / eclipse-platform/eclipse.platform

Job framework become unusable after stopping and restarting the "org.eclipse.core.jobs" bundle

Open
#2,783 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
165
Forks
174
Avg merge
2d 8h
Merged PRs (30d)
22

Description

Let's make sure issue is not already fixed in latest builds first.

- [x] I verified I can reproduce this issue against [latest Integration Build of Eclipse SDK](https://download.eclipse.org/eclipse/downloads/)

Not checked with the latest Build, but checked that the affected bundle has been unchanged compared to the version I tried with.

## Steps to reproduce

* In a running application, stop the "org.eclipse.core.jobs" bundle
* restart the bundle
* create a new job

This fails with an exception

I expected: That the bundle can be stopped and restarted

But got: it becomes unusable after restarting

Looking at the failing code, it looks like the class "InternalJob" keeps a cached instance of the first ever created JobManager in a static final field and only uses that for all created instances of InternalJob instead of using the current running JobManager.

## Here is some relevant log output

From `/.metadata/.log`

```java
Command-line arguments: -application eclipse-core-jobs-sample.id1 -data W:\fis\ws\fa_99.99.0/../runtime-eclipse-core-jobs-sample.id1 -dev file:///W:/fis/ws/fa_99.99.0/.metadata/.plugins/org.eclipse.pde.core/eclipse-core-jobs-sample.id1/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog

!ENTRY org.eclipse.osgi 4 0 2026-06-28 11:40:00.218
!MESSAGE Application error
!STACK 1
java.lang.IllegalStateException: Job manager has been shut down.
at org.eclipse.core.internal.jobs.JobManager.scheduleInternal(JobManager.java:1485)
at org.eclipse.core.internal.jobs.JobManager.lambda$5(JobManager.java:1475)
at org.eclipse.core.internal.jobs.JobManager.withWriteLock(JobManager.java:568)
at org.eclipse.core.internal.jobs.JobManager.schedule(JobManager.java:1474)
at org.eclipse.core.internal.jobs.InternalJob.schedule(InternalJob.java:402)
at org.eclipse.core.runtime.jobs.Job.schedule(Job.java:654)
at sample.Application.start(Application.java:35)
```

## Code for reproduction
```java
BundleContext bundleContext = FrameworkUtil.getBundle(getClass()).getBundleContext();

Bundle coreJobs = Arrays.stream( bundleContext.getBundles()).filter(x -> x.getSymbolicName().equals("org.eclipse.core.jobs")).findFirst().orElseThrow();

coreJobs.stop();

coreJobs.start();

Job job = new Job("test") {

@Override
protected IStatus run(IProgressMonitor monitor) {
return Status.OK_STATUS;
}
};
job.schedule();
```

## Tested under this environment:
* OS & version: Windows, 11
* Eclipse IDE/Platform version (as shown in *Help > About*): Eclipse 25-12

## Community

- [x] I understand reporting an issue to this OSS project does not mandate anyone to fix it. Other contributors may consider the issue, or not, at their own convenience. The most efficient way to get it fixed is that I fix it myself and contribute it back as a good quality patch to the project.

Contributor guide

Open the contributing guide

Research direction

Reproduce the stop-and-restart sequence for the org.eclipse.core.jobs bundle, then start with org.eclipse.core.internal.jobs.InternalJob and JobManager, especially the scheduling path shown in the stack trace. Check how the restarted bundle is represented when a new Job is scheduled. Done means a job can be created and scheduled after the bundle restart, with regression coverage for the reported sequence.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.