{"record":{"id":"46986896239edaff","repo":"eclipse-vertx/vert.x","slug":"maxeventloopexecutetime-must-be-0","errorCode":null,"errorMessage":"maxEventLoopExecuteTime must be > 0","messagePattern":"maxEventLoopExecuteTime must be > 0","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/VertxOptions.java","lineNumber":297,"sourceCode":"   * The default value of {@link VertxOptions#setMaxEventLoopExecuteTimeUnit maxEventLoopExecuteTimeUnit} is {@link TimeUnit#NANOSECONDS}\n   *\n   * @return the value of max event loop execute time, in {@link VertxOptions#setMaxEventLoopExecuteTimeUnit maxEventLoopExecuteTimeUnit}.\n   */\n  public long getMaxEventLoopExecuteTime() {\n    return maxEventLoopExecuteTime;\n  }\n\n  /**\n   * Sets the value of max event loop execute time, in {@link VertxOptions#setMaxEventLoopExecuteTimeUnit maxEventLoopExecuteTimeUnit}.\n   * <p>\n   * The default value of {@link VertxOptions#setMaxEventLoopExecuteTimeUnit maxEventLoopExecuteTimeUnit}is {@link TimeUnit#NANOSECONDS}\n   *\n   * @param maxEventLoopExecuteTime the value of max event loop execute time, in {@link VertxOptions#setMaxEventLoopExecuteTimeUnit maxEventLoopExecuteTimeUnit}.\n   * @return a reference to this, so the API can be used fluently\n   */\n  public VertxOptions setMaxEventLoopExecuteTime(long maxEventLoopExecuteTime) {\n    if (maxEventLoopExecuteTime < 1) {\n      throw new IllegalArgumentException(\"maxEventLoopExecuteTime must be > 0\");\n    }\n    this.maxEventLoopExecuteTime = maxEventLoopExecuteTime;\n    return this;\n  }\n\n  /**\n   * Get the value of max worker execute time, in {@link VertxOptions#setMaxWorkerExecuteTimeUnit maxWorkerExecuteTimeUnit}.\n   * <p>\n   * Vert.x will automatically log a warning if it detects that worker threads haven't returned within this time.\n   * <p>\n   * This can be used to detect where the user is blocking a worker thread for too long. Although worker threads\n   * can be blocked longer than event loop threads, they shouldn't be blocked for long periods of time.\n   * <p>\n   * 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() {","sourceCodeStart":279,"sourceCodeEnd":315,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/VertxOptions.java#L279-L315","documentation":"VertxOptions.setMaxEventLoopExecuteTime throws IllegalArgumentException for any value < 1. This setting is the threshold after which an event-loop thread is considered blocked (logged/exception via the blocked-thread checker), expressed in maxEventLoopExecuteTimeUnit. A non-positive threshold would mark every task as instantly blocked or never schedule the check correctly, so Vert.x rejects it upfront.","triggerScenarios":"new VertxOptions().setMaxEventLoopExecuteTime(0) or a negative value; VertxOptions.fromJson with JSON \"maxEventLoopExecuteTime\" <= 0; tests like testBlockCheckExceptionTimeLimit setting it to probe the checker.","commonSituations":"Configuring very aggressive blocked-warning thresholds by hand and slipping in 0; unit/time arithmetic producing 0 (e.g. seconds*1000 with seconds=0); copying values from another options object that was never initialized.","solutions":["Pass a positive duration, e.g. setMaxEventLoopExecuteTime(2000000000) with the default NANOSECONDS unit (2s).","Verify the paired unit (setMaxEventLoopExecuteTimeUnit) so the numeric value is interpreted as intended and stays >= 1.","Guard JSON-driven config: only apply the field when it parses to a value >= 1."],"exampleFix":"// before\nopts.setMaxEventLoopExecuteTime(0).setMaxEventLoopExecuteTimeUnit(TimeUnit.SECONDS);\n// after\nopts.setMaxEventLoopExecuteTime(2).setMaxEventLoopExecuteTimeUnit(TimeUnit.SECONDS);","handlingStrategy":"validation","validationCode":"if (maxEventLoopExecuteTime < 1) throw new IllegalArgumentException(\"maxEventLoopExecuteTime must be >= 1\");\noptions.setMaxEventLoopExecuteTime(maxEventLoopExecuteTime);","typeGuard":null,"tryCatchPattern":"try {\n  options.setMaxEventLoopExecuteTime(v);\n} catch (IllegalArgumentException e) {\n  throw new IllegalArgumentException(\"config maxEventLoopExecuteTime invalid: \" + e.getMessage(), e);\n}","preventionTips":["Keep value and unit together in one config object to avoid unit-conversion zeros","Use long arithmetic and assert >= 1 after any unit conversion","Pair it with setWarningExceptionTime so thresholds stay ordered"],"tags":["vertx","configuration","event-loop","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"}