eclipse-vertx / eclipse-vertx/vert.x

Feature: disable blocked thread warnings until application is started

Open
#1,379 21 comments 19 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
14.7k
Forks
2.1k
Avg merge
2d 7h
Merged PRs (30d)
28

Description

**tl;dr:** Following the "golden rule" during application startup and initialization may be unimportant. Therefore please provide a way to disable warnings until application is fully deployed and started.

The reason I am requesting this is because my company has a large vert.x 2 ruby application (ported from rails/sinatra) that is being upgraded to vert.x 3. We do a lot of pre-loading during application startup, and it would be difficult to make all of that asynchronous or wrapped with execute_blocking. We're getting the multiple warnings and large stacktrace during application startup.

But during application startup, I don't mind blocking the event loop, because there's no other work the application could be doing that's being blocked. Once verticles are started and accepting requests, I do want to see the warnings.

Therefore, I'd like to have some mechanism to disable event loop warnings/stacktraces until the application has been fully deployed.

A few ideas for how this could be done:
1. Add more general `disableBlockedThreadWarnings` and `enableBlockedThreadWarnings` methods to `Vertx`. Those would call new setter on `BlockedThreadChecker` to set value on a `final AtomicBoolean`. Within the timer task `run()` method, check value before logging. I like this solution the best.
2. Add a `ready()` (for example) method to `Vertx`, along with a new option to disable warnings until `ready()` is called. Less flexible, but same effect during application startup.
3. Extract the 4 options that affect this (`blockedThreadCheckInterval`, `maxEventLoopExecuteTime`, `maxWorkerExecuteTime`, `warningExceptionTime`) into their own class, and provide a static instance with defaults. Provide a way to replace the instance at runtime.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.