eclipse-vertx/vert.x · error · IllegalArgumentException
maxExecuteTime must be > 0
Error message
maxExecuteTime must be > 0
What it means
createSharedWorkerPool validates the maximum worker execution time and throws IllegalArgumentException when maxExecuteTime < 1. This value drives the thread-blocked checker; a non-positive timeout would disable meaningful blocking detection and cannot be configured.
Source
Thrown at vertx-core/src/main/java/io/vertx/core/impl/VertxImpl.java:1109
@Override
public synchronized WorkerExecutorImpl createSharedWorkerExecutor(String name, int poolSize, long maxExecuteTime) {
return createSharedWorkerExecutor(name, poolSize, maxExecuteTime, maxWorkerExecTimeUnit);
}
@Override
public synchronized WorkerExecutorImpl createSharedWorkerExecutor(String name, int poolSize, long maxExecuteTime, TimeUnit maxExecuteTimeUnit) {
CloseableResource<WorkerPool> sharedWorkerPool = createSharedWorkerPool(name, poolSize, maxExecuteTime, maxExecuteTimeUnit);
sharedWorkerPool = registerResource(sharedWorkerPool);
return new WorkerExecutorImpl(this, CleanerProvider.INSTANCE.get(), sharedWorkerPool);
}
public CloseableResource<WorkerPool> createSharedWorkerPool(String name, int poolSize, long maxExecuteTime, TimeUnit maxExecuteTimeUnit) {
if (poolSize < 1) {
throw new IllegalArgumentException("poolSize must be > 0");
}
if (maxExecuteTime < 1) {
throw new IllegalArgumentException("maxExecuteTime must be > 0");
}
Supplier<WorkerPool> factory = () -> {
ThreadFactory workerThreadFactory = createThreadFactory(threadFactory, checker, useDaemonThread, maxExecuteTime, maxExecuteTimeUnit, name + "-", true);
ExecutorService workerExec = executorServiceFactory.createExecutor(workerThreadFactory, poolSize, poolSize);
PoolMetrics<?, ?> workerMetrics = metrics != null ? metrics.createPoolMetrics("worker", name, poolSize) : null;
return new WorkerPool(workerExec, workerMetrics);
};
return createSharedResource("__vertx.shared.workerPools", name, factory);
}
@Override
public WorkerPool wrapWorkerPool(ExecutorService executor) {
PoolMetrics workerMetrics = metrics != null ? metrics.createPoolMetrics( "worker", null, -1) : null;
return new WorkerPool(executor, workerMetrics);
}
private ThreadFactory createThreadFactory(VertxThreadFactory threadFactory, BlockedThreadChecker checker, Boolean useDaemonThread, long maxExecuteTime, TimeUnit maxExecuteTimeUnit, String prefix, boolean worker) {
AtomicInteger threadCount = new AtomicInteger(0);View on GitHub (pinned to fb308bd8c3)
Solutions
- Pass maxExecuteTime >= 1 in the chosen TimeUnit, e.g. Math.max(1, configured)
- To express a very long limit, use a large value with TimeUnit like 1 with TimeUnit.HOURS rather than 0
- Validate config at startup and reject non-positive execute times
Example fix
// before
vertx.createSharedWorkerPool("blocking", 10, 0, TimeUnit.SECONDS); // throws
// after
vertx.createSharedWorkerPool("blocking", 10, 1, TimeUnit.HOURS); Defensive patterns
Strategy: validation
Validate before calling
if (maxExecuteTime < 1) {
throw new IllegalArgumentException("maxExecuteTime must be >= 1, got " + maxExecuteTime);
} Try / catch
try {
vertx.createSharedWorkerPool(name, poolSize, maxExecuteTime, unit);
} catch (IllegalArgumentException e) {
// use a sane default like 60s
} Prevention
- Remember 0 does not mean 'unlimited' here; use a large value + TimeUnit instead
- Check conversions that truncate small values to 0
- Validate execute-time config at load
When it happens
Trigger: vertx.createSharedWorkerPool(name, poolSize, maxExecuteTime, maxExecuteTimeUnit) with maxExecuteTime 0 or negative — e.g. config value in seconds converted to 0, or 0 intended as 'unlimited'.
Common situations: maxExecuteTimeUnit conversion producing 0 (e.g. sub-unit values truncated); 0 mistakenly used to mean 'no limit' (there is no such option here); negative values from bad config files.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- poolSize must be > 0
- maxWorkerpExecuteTime must be > 0
- Can't specify < 1 instances to deploy
- workerPoolSize must be > 0
- blockedThreadCheckInterval must be > 0
AI-assisted analysis of eclipse-vertx/vert.x@fb308bd8c3 (2026-09-06).
Data as JSON: /api/errors/5b6cc7947d7eb8ec.
Report an issue: GitHub.