**Build scan:**
https://gradle-enterprise.elastic.co/s/ud4ggnomaa7p6/tests/:x-pack:plugin:ml:test/org.elasticsearch.xpack.ml.job.process.ProcessWorkerExecutorServiceTests/testAutodetectWorkerExecutorServiceDoesNotSwallowErrors
**Reproduction line:**
```
./gradlew ':x-pack:plugin:ml:test' --tests "org.elasticsearch.xpack.ml.job.process.ProcessWorkerExecutorServiceTests.testAutodetectWorkerExecutorServiceDoesNotSwallowErrors" -Dtests.seed=FCF6267296BD3EED -Dtests.locale=pl -Dtests.timezone=CST6CDT -Druntime.java=21
```

**Applicable branches:**
main

**Reproduces locally?:**
Yes

**Failure history:**
https://gradle-enterprise.elastic.co/scans/tests?tests.container=org.elasticsearch.xpack.ml.job.process.ProcessWorkerExecutorServiceTests&tests.test=testAutodetectWorkerExecutorServiceDoesNotSwallowErrors
**Failure excerpt:**
```
java.lang.Exception: Test abandoned because suite timeout was reached.

  at __randomizedtesting.SeedInfo.seed([FCF6267296BD3EED]:0)

```
x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/job/process/ProcessWorkerExecutorServiceTests.java
latch.countDown();
        executorFinished.get();
        assertFalse(runnableShouldNotBeCalled.get());
        
        assertEquals(0, doRunCallCount.get());
        assertThat(exceptions, hasSize(2));
        for (var e : exceptions) {
            if (shutdownWithError) {
                assertThat(e.getMessage(), containsString("stopping the executor because an error occurred"));
            } else {
                assertThat(e, isA(EsRejectedExecutionException.class));
            }
        }
    }
    @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/101144")
    public void testAutodetectWorkerExecutorServiceDoesNotSwallowErrors() {
        ProcessWorkerExecutorService executor = createExecutorService();
        if (randomBoolean()) {
            executor.submit(() -> { throw new Error("future error"); });
        } else {
            executor.execute(() -> { throw new Error("future error"); });
        }
        Error e = expectThrows(Error.class, executor::start);
        assertThat(e.getMessage(), containsString("future error"));
    }
    private ProcessWorkerExecutorService createExecutorService() {
        return new ProcessWorkerExecutorService(threadPool.getThreadContext(), TEST_PROCESS, QUEUE_SIZE);
    }
}