{"record":{"id":"34beccd74dbf1dc7","repo":"eclipse-vertx/vert.x","slug":"maxworkerpexecutetime-must-be-0","errorCode":null,"errorMessage":"maxWorkerpExecuteTime must be > 0","messagePattern":"maxWorkerpExecuteTime must be > 0","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/VertxOptions.java","lineNumber":329,"sourceCode":"   * The default value of {@link VertxOptions#setMaxWorkerExecuteTimeUnit maxWorkerExecuteTimeUnit} is {@link TimeUnit#NANOSECONDS}\n   *\n   * @return The value of max worker execute time, in {@link VertxOptions#setMaxWorkerExecuteTimeUnit maxWorkerExecuteTimeUnit}.\n   */\n  public long getMaxWorkerExecuteTime() {\n    return maxWorkerExecuteTime;\n  }\n\n  /**\n   * Sets the value of max worker execute time, in {@link VertxOptions#setMaxWorkerExecuteTimeUnit maxWorkerExecuteTimeUnit}.\n   * <p>\n   * The default value of {@link VertxOptions#setMaxWorkerExecuteTimeUnit maxWorkerExecuteTimeUnit} is {@link TimeUnit#NANOSECONDS}\n   *\n   * @param maxWorkerExecuteTime the value of max worker execute time, in {@link VertxOptions#setMaxWorkerExecuteTimeUnit maxWorkerExecuteTimeUnit}.\n   * @return a reference to this, so the API can be used fluently\n   */\n  public VertxOptions setMaxWorkerExecuteTime(long maxWorkerExecuteTime) {\n    if (maxWorkerExecuteTime < 1) {\n      throw new IllegalArgumentException(\"maxWorkerpExecuteTime must be > 0\");\n    }\n    this.maxWorkerExecuteTime = maxWorkerExecuteTime;\n    return this;\n  }\n\n  /**\n   * Get the value of internal blocking pool size.\n   * <p>\n   * Vert.x maintains a pool for internal blocking operations\n   *\n   * @return the value of internal blocking pool size\n   */\n  public int getInternalBlockingPoolSize() {\n    return internalBlockingPoolSize;\n  }\n\n  /**\n   * Set the value of internal blocking pool size","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/VertxOptions.java#L311-L347","documentation":"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.","triggerScenarios":"new VertxOptions().setMaxWorkerExecuteTime(0) or negative; VertxOptions.fromJson with \"maxWorkerExecuteTime\" <= 0; tests testBlockCheckWorker/testBlockCheckExecuteBlocking configuring worker timeouts.","commonSituations":"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.","solutions":["Pass a positive value, e.g. setMaxWorkerExecuteTime(60000000000L) with default NANOSECONDS (60s).","Check integer truncation in unit conversion (e.g. ns->ms) that could floor a small value to 0.","Validate the JSON field before fromJson: reject or default values < 1."],"exampleFix":"// before\nopts.setMaxWorkerExecuteTime(conf.getLong(\"workerMax\", 0L));\n// after\nopts.setMaxWorkerExecuteTime(Math.max(1, conf.getLong(\"workerMax\", 60_000_000_000L)));","handlingStrategy":"validation","validationCode":"if (maxWorkerExecuteTime < 1) throw new IllegalArgumentException(\"maxWorkerExecuteTime must be >= 1\");\noptions.setMaxWorkerExecuteTime(maxWorkerExecuteTime);","typeGuard":null,"tryCatchPattern":"try {\n  options.setMaxWorkerExecuteTime(v);\n} catch (IllegalArgumentException e) {\n  log.warn(\"Invalid maxWorkerExecuteTime, falling back to 60s\");\n  options.setMaxWorkerExecuteTime(TimeUnit.SECONDS.toNanos(60));\n}","preventionTips":["Compute durations with TimeUnit conversions, never hand-written multipliers","Validate the whole options JSON against a schema (all fields >= 1) before fromJson","Add a startup sanity check comparing worker vs event-loop thresholds"],"tags":["vertx","configuration","worker-pool","options-validation"],"backgroundTag":"invalid-config-value","analyzedSha":"fb308bd8c3f12c79f4ae89bef67fadf6c80d036e","analyzedAt":"2026-09-06T11:37:12.241Z","contentChangedAt":"2026-09-06T11:37:12.241Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}