The BlockedThreadChecker causes a lot of stdout when debugging vert.x code. This question relates to vert.x 3.
4 Answers
VertxOptions options = new VertxOptions();
options.setBlockedThreadCheckInterval(1000*60*60);
https://groups.google.com/forum/#!searchin/vertx/BlockedThreadChecker/vertx/MWx8ma7Ig4o/rFqdYdDErtYJ
NOTE: Disable only for debugging. Otherwise issues which can affect the performance of Vert.x can't be located easily.
- 3,270
- 3
- 31
- 52
-
2Please really only do this when debugging, never in production. If you have code that blocks the event loop, fix that code, e.g. by moving parts of it to a worker. – David Oct 21 '18 at 21:49
Alternatively you can add the following system property to the vertx startup script, will set the event loop execute time to 10 seconds (note the input is in NS):
-Dvertx.options.maxEventLoopExecuteTime=10000000000
- 1,116
- 10
- 29
-
Does this still work in the latest version 4+ in 2023? It does not work for me. – kevinarpe Aug 27 '23 at 12:59
For anybody interested on this, in case you don't want to change vertx options, you can set the log level to ERROR or OFF for BlockedThreadChecker.
Configuration in logback.xml will look something like this:
<configuration>
...
<logger name="io.vertx.core.impl.BlockedThreadChecker" level="OFF" />
...
</configuration>
- 757
- 6
- 15
Our thread blocking issues are during deployment so we simply turn off logging dynamically during deployment and turn it back on once that's complete log4j2 this looks like:
org.apache.logging.log4j.core.Logger threadStuckLogger = (org.apache.logging.log4j.core.Logger)LogManager.getLogger(BlockedThreadChecker.class);
Level threadStuckLevel = threadStuckLogger.getLevel();
threadStuckLogger.setLevel(Level.ERROR);
// deploy....
threadStuckLogger.setLevel(threadStuckLevel);
- 553
- 6
- 8