{"record":{"id":"2bf37027afca3ca2","repo":"eclipse-vertx/vert.x","slug":"blockedthreadcheckinterval-must-be-0","errorCode":null,"errorMessage":"blockedThreadCheckInterval must be > 0","messagePattern":"blockedThreadCheckInterval must be > 0","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/VertxOptions.java","lineNumber":265,"sourceCode":"   * The default value of {@link VertxOptions#setBlockedThreadCheckIntervalUnit blockedThreadCheckIntervalUnit} is {@link TimeUnit#MILLISECONDS}.\n   *\n   * @return the value of blocked thread check period, in {@link VertxOptions#setBlockedThreadCheckIntervalUnit blockedThreadCheckIntervalUnit}.\n   */\n  public long getBlockedThreadCheckInterval() {\n    return blockedThreadCheckInterval;\n  }\n\n  /**\n   * Sets the value of blocked thread check period, in {@link VertxOptions#setBlockedThreadCheckIntervalUnit blockedThreadCheckIntervalUnit}.\n   * <p>\n   * The default value of {@link VertxOptions#setBlockedThreadCheckIntervalUnit blockedThreadCheckIntervalUnit} is {@link TimeUnit#MILLISECONDS}\n   *\n   * @param blockedThreadCheckInterval the value of blocked thread check period, in {@link VertxOptions#setBlockedThreadCheckIntervalUnit blockedThreadCheckIntervalUnit}.\n   * @return a reference to this, so the API can be used fluently\n   */\n  public VertxOptions setBlockedThreadCheckInterval(long blockedThreadCheckInterval) {\n    if (blockedThreadCheckInterval < 1) {\n      throw new IllegalArgumentException(\"blockedThreadCheckInterval must be > 0\");\n    }\n    this.blockedThreadCheckInterval = blockedThreadCheckInterval;\n    return this;\n  }\n\n  /**\n   * Get the value of max event loop execute time, in {@link VertxOptions#setMaxEventLoopExecuteTimeUnit maxEventLoopExecuteTimeUnit}.\n   * <p>\n   * Vert.x will automatically log a warning if it detects that event loop threads haven't returned within this time.\n   * <p>\n   * This can be used to detect where the user is blocking an event loop thread, contrary to the Golden Rule of the\n   * holy Event Loop.\n   * <p>\n   * 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() {","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/VertxOptions.java#L247-L283","documentation":"VertxOptions.setBlockedThreadCheckInterval rejects any value below 1 with an IllegalArgumentException. The blocked-thread-check interval controls how often Vert.x's checker scans for event-loop threads blocked longer than maxEventLoopExecuteTime; a zero or negative period is meaningless because the check would never run or would run with invalid scheduling semantics. The library throws eagerly at option-setting time so misconfiguration fails fast instead of producing a silently broken blocked-thread detector.","triggerScenarios":"Calling new VertxOptions().setBlockedThreadCheckInterval(0) or any negative long; VertxOptions.fromJson(JsonObject) with a JSON field \"blockedThreadCheckInterval\" of 0 or negative.","commonSituations":"Copying options objects and accidentally overwriting the field with 0 as a sentinel; deserializing an incomplete config JSON where the field defaults to 0; computing the interval from an expression that evaluates to 0 (e.g. value*unit arithmetic on empty config).","solutions":["Pass a positive value, e.g. setBlockedThreadCheckInterval(1000) (milliseconds by default).","If building from JSON, ensure the blockedThreadCheckInterval key is present and >= 1, or omit it to keep the default (1000 ms).","Clamp user-supplied config before calling the setter: options.setBlockedThreadCheckInterval(Math.max(1, configured))."],"exampleFix":"// before\nnew VertxOptions().setBlockedThreadCheckInterval(0);\n// after\nnew VertxOptions().setBlockedThreadCheckInterval(1000); // 1s default-like period","handlingStrategy":"validation","validationCode":"if (blockedThreadCheckInterval < 1) throw new IllegalArgumentException(\"blockedThreadCheckInterval must be >= 1\");\noptions.setBlockedThreadCheckInterval(blockedThreadCheckInterval);","typeGuard":null,"tryCatchPattern":"try {\n  options.setBlockedThreadCheckInterval(interval);\n} catch (IllegalArgumentException e) {\n  log.warn(\"Invalid blockedThreadCheckInterval {}, using default 1000\", interval);\n  options.setBlockedThreadCheckInterval(1000);\n}","preventionTips":["Centralize VertxOptions construction in one factory that validates all interval fields","Default missing JSON fields to Vert.x's documented defaults instead of 0","Unit-test your options-from-config path with edge values 0 and -1"],"tags":["vertx","configuration","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"}