23

The BlockedThreadChecker causes a lot of stdout when debugging vert.x code. This question relates to vert.x 3.

Jotschi
  • 3,270
  • 3
  • 31
  • 52

4 Answers4

19
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.

Jotschi
  • 3,270
  • 3
  • 31
  • 52
  • 2
    Please 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
13

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

adamM
  • 1,116
  • 10
  • 29
9

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>
ramtech
  • 757
  • 6
  • 15
1

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);
MSillence
  • 553
  • 6
  • 8