question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Blockhound detects a blocking call inside GlobalEventExecutor#addTask

See original GitHub issue

Expected behavior

No blocking calls detected by BlockHound.

Actual behavior

I observe the same problem originally reported by @62mkv in https://github.com/reactor/reactor-netty/issues/1086:

Occasionally, BlockHound-enabled Spring Boot (w/WebFlux) test suite fails to complete correctly because of such exception w/ the following trace:

18:03:03.327 [reactor-http-nio-2] ERROR io.netty.util.concurrent.DefaultPromise.rejectedExecution - Failed to submit a listener notification task. Event loop shut down?
reactor.blockhound.BlockingOperationError: Blocking call! sun.misc.Unsafe#park
        at sun.misc.Unsafe.park(Unsafe.java)
        at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
        at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:836)
        at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:870)
        at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1199)
        at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:209)
        at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:285)
        at java.util.concurrent.LinkedBlockingQueue.offer(LinkedBlockingQueue.java:418)
        at java.util.AbstractQueue.add(AbstractQueue.java:95)
        at io.netty.util.concurrent.GlobalEventExecutor.addTask(GlobalEventExecutor.java:141)
        at io.netty.util.concurrent.GlobalEventExecutor.execute(GlobalEventExecutor.java:206)
        at io.netty.util.concurrent.DefaultPromise.safeExecute(DefaultPromise.java:841)
        at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:498)
        at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:615)
        at io.netty.util.concurrent.DefaultPromise.setSuccess0(DefaultPromise.java:604)
        at io.netty.util.concurrent.DefaultPromise.setSuccess(DefaultPromise.java:96)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:1051)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)

reactor-netty maintainer @violetagg suggested the issue should be moved to this project. I haven’t found it here, so I’m opening it.

Workaround

It’s possible to whitelist this directly in the application as a temporary solution:

  private static final class NettyWorkaroundBlockHoundIntegration implements BlockHoundIntegration {
    @Override
    void applyTo(BlockHound.Builder builder) {
      builder.allowBlockingCallsInside(GlobalEventExecutor.class.name, 'addTask')
    }
  }

Netty version

4.1.48.Final

JVM version (e.g. java -version)

openjdk version “11.0.4” 2019-07-16

OS version (e.g. uname -a)

Mac OS X 10.15.2 x86_64, Win10

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
pbetkiercommented, May 7, 2020

sure

0reactions
pbetkiercommented, May 8, 2020

I’ve created a PR, verified it solves my problem after mvn install and using the SNAPSHOT version in my project.

Read more comments on GitHub >

github_iconTop Results From Across the Web

BlockHound detects blocking call for ReactiveRedisTemplate ...
I'm using spring-boot-starter-data-redis-reactive dependency for reactive redis client and blockhound for detecting blocking calls.
Read more >
BlockHound: detect blocking calls in Reactive code before it's ...
The first test method verifies that blocking code is not allowed when executed from within a Non-Blocking thread belonging to the Schedulers.parallel() ...
Read more >
Blockhound detects a blocking call from kotlin-reflect in Spring ...
There is blocking call detected by BlockHound when calling kotlin controller in Spring Boot WebFlux 2.4.4 application. Program was run with JDK 11...
Read more >
reactor/BlockHound - Gitter
reactor.blockhound.BlockingOperationError: Blocking call! jdk.internal.misc. ... Why BlockHound detects it as a blocking call?
Read more >
BlockHound and Blocking Calls: How It Works - Foojay
BlockHound lets you check if a blocking call occurs in a thread where it shouldn't happen and throws an exception at runtime when...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found