eclipse-vertx/vert.x · error · IllegalArgumentException

maxWorkerpExecuteTime must be > 0

Error message

maxWorkerpExecuteTime must be > 0

What it means

VertxOptions.setMaxWorkerExecuteTime throws IllegalArgumentException when maxWorkerExecuteTime < 1. This is the worker-thread analogue of the event-loop execute-time threshold: it determines when a thread from the worker pool is flagged as blocked. Non-positive values are rejected because they make the blocked-thread checker semantics invalid. Note the message contains a typo ("maxWorkerpExecuteTime") that is part of the thrown text.

Source

Thrown at vertx-core/src/main/java/io/vertx/core/VertxOptions.java:329

   * The default value of {@link VertxOptions#setMaxWorkerExecuteTimeUnit maxWorkerExecuteTimeUnit} is {@link TimeUnit#NANOSECONDS}
   *
   * @return The value of max worker execute time, in {@link VertxOptions#setMaxWorkerExecuteTimeUnit maxWorkerExecuteTimeUnit}.
   */
  public long getMaxWorkerExecuteTime() {
    return maxWorkerExecuteTime;
  }

  /**
   * Sets the value of max worker execute time, in {@link VertxOptions#setMaxWorkerExecuteTimeUnit maxWorkerExecuteTimeUnit}.
   * <p>
   * The default value of {@link VertxOptions#setMaxWorkerExecuteTimeUnit maxWorkerExecuteTimeUnit} is {@link TimeUnit#NANOSECONDS}
   *
   * @param maxWorkerExecuteTime the value of max worker execute time, in {@link VertxOptions#setMaxWorkerExecuteTimeUnit maxWorkerExecuteTimeUnit}.
   * @return a reference to this, so the API can be used fluently
   */
  public VertxOptions setMaxWorkerExecuteTime(long maxWorkerExecuteTime) {
    if (maxWorkerExecuteTime < 1) {
      throw new IllegalArgumentException("maxWorkerpExecuteTime must be > 0");
    }
    this.maxWorkerExecuteTime = maxWorkerExecuteTime;
    return this;
  }

  /**
   * Get the value of internal blocking pool size.
   * <p>
   * Vert.x maintains a pool for internal blocking operations
   *
   * @return the value of internal blocking pool size
   */
  public int getInternalBlockingPoolSize() {
    return internalBlockingPoolSize;
  }

  /**
   * Set the value of internal blocking pool size

View on GitHub (pinned to fb308bd8c3)

Solutions

  1. Pass a positive value, e.g. setMaxWorkerExecuteTime(60000000000L) with default NANOSECONDS (60s).
  2. Check integer truncation in unit conversion (e.g. ns->ms) that could floor a small value to 0.
  3. Validate the JSON field before fromJson: reject or default values < 1.

Example fix

// before
opts.setMaxWorkerExecuteTime(conf.getLong("workerMax", 0L));
// after
opts.setMaxWorkerExecuteTime(Math.max(1, conf.getLong("workerMax", 60_000_000_000L)));
Defensive patterns

Strategy: validation

Validate before calling

if (maxWorkerExecuteTime < 1) throw new IllegalArgumentException("maxWorkerExecuteTime must be >= 1");
options.setMaxWorkerExecuteTime(maxWorkerExecuteTime);

Try / catch

try {
  options.setMaxWorkerExecuteTime(v);
} catch (IllegalArgumentException e) {
  log.warn("Invalid maxWorkerExecuteTime, falling back to 60s");
  options.setMaxWorkerExecuteTime(TimeUnit.SECONDS.toNanos(60));
}

Prevention

When it happens

Trigger: new VertxOptions().setMaxWorkerExecuteTime(0) or negative; VertxOptions.fromJson with "maxWorkerExecuteTime" <= 0; tests testBlockCheckWorker/testBlockCheckExecuteBlocking configuring worker timeouts.

Common situations: Setting worker blocked thresholds alongside warningExceptionTime and mixing up which setter gets 0; generating options from YAML/JSON where the value arrives as 0; unit-conversion bugs (ms vs ns) yielding 0 after truncation.

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


AI-assisted analysis of eclipse-vertx/vert.x@fb308bd8c3 (2026-09-06). Data as JSON: /api/errors/34beccd74dbf1dc7. Report an issue: GitHub.