{"record":{"id":"4ddf834c3df2aa6d","repo":"eclipse-vertx/vert.x","slug":"warningexceptiontime-must-be-0","errorCode":null,"errorMessage":"warningExceptionTime must be > 0","messagePattern":"warningExceptionTime must be > 0","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/VertxOptions.java","lineNumber":480,"sourceCode":"   * <p>\n   * The default value of {@link VertxOptions#setWarningExceptionTimeUnit warningExceptionTimeUnit} is {@link TimeUnit#NANOSECONDS}\n   *\n   * @return the warning exception time threshold\n   */\n  public long getWarningExceptionTime() {\n    return warningExceptionTime;\n  }\n\n  /**\n   * Set the threshold value above this, the blocked warning contains a stack trace. in {@link VertxOptions#setWarningExceptionTimeUnit warningExceptionTimeUnit}.\n   * The default value of {@link VertxOptions#setWarningExceptionTimeUnit warningExceptionTimeUnit} is {@link TimeUnit#NANOSECONDS}\n   *\n   * @param warningExceptionTime\n   * @return a reference to this, so the API can be used fluently\n   */\n  public VertxOptions setWarningExceptionTime(long warningExceptionTime) {\n    if (warningExceptionTime < 1) {\n      throw new IllegalArgumentException(\"warningExceptionTime must be > 0\");\n    }\n    this.warningExceptionTime = warningExceptionTime;\n    return this;\n  }\n\n  /**\n   * @return the event bus option to configure the event bus communication (host, port, ssl...)\n   */\n  public EventBusOptions getEventBusOptions() {\n    return eventBusOptions;\n  }\n\n  /**\n   * Sets the event bus configuration to configure the host, port, ssl...\n   *\n   * @param options the event bus options\n   * @return a reference to this, so the API can be used fluently\n   */","sourceCodeStart":462,"sourceCodeEnd":498,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/VertxOptions.java#L462-L498","documentation":"VertxOptions.setWarningExceptionTime throws IllegalArgumentException for values < 1. This is the interval after which a still-blocked thread escalates from a warning-level log to an exception-level log in the blocked-thread checker, expressed in warningExceptionTimeUnit. Non-positive values are rejected because the escalation timer would fire immediately or never, corrupting the checker's log semantics.","triggerScenarios":"new VertxOptions().setWarningExceptionTime(0) or negative; VertxOptions.fromJson with \"warningExceptionTime\" <= 0; blocked-checker tests (testBlockCheckExceptionTimeLimit, testBlockCheckWorker, testBlockCheckExecuteBlocking, testCustomThreadBlockedHandler) tuning escalation timing.","commonSituations":"Misreading the field as 'time after which to warn' and setting 0 to disable warnings; unit mixups (writing a seconds value while the unit is nanoseconds is fine, but writing 0 to 'disable' is not); copying options where warningExceptionTime was zeroed.","solutions":["Pass a positive value, e.g. setWarningExceptionTime(5000) with the default NANOSECONDS semantics matching maxWorkerExecuteTime.","Keep warningExceptionTime >= maxWorkerExecuteTime/maxEventLoopExecuteTime so escalation happens after the initial blocked threshold.","If you need to suppress escalation logging, configure the blocked-thread checker's log level or a custom handler instead of zeroing this value."],"exampleFix":"// before\nopts.setWarningExceptionTime(0); // intent: never escalate\n// after\nopts.setWarningExceptionTime(5_000_000_000L); // 5s escalation with default ns unit","handlingStrategy":"validation","validationCode":"if (warningExceptionTime < 1) throw new IllegalArgumentException(\"warningExceptionTime must be >= 1\");\noptions.setWarningExceptionTime(warningExceptionTime);","typeGuard":null,"tryCatchPattern":"try {\n  options.setWarningExceptionTime(v);\n} catch (IllegalArgumentException e) {\n  log.warn(\"Invalid warningExceptionTime, using 5s\");\n  options.setWarningExceptionTime(5_000_000_000L);\n}","preventionTips":["Keep warningExceptionTime >= the blocked thresholds so escalation order is sane","Use TimeUnit conversions instead of raw zero 'disable' values","Build VertxOptions via a single validated factory in your codebase"],"tags":["vertx","configuration","blocked-thread-checker","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-14T05:17:10.506Z"}