BlockHound: detect blocking calls in Reactive code before it’s too late
Find the blockage that clogs your reactive streams pipelines before it hits production!
In the era of Reactive Programming, one of the most common concerns is to spot blocking calls and embed them properly in reactive code or replace them with a reactive alternative when possible.
It’s really easy to miss some of these blocking operations and end up shipping to production something that shouldn’t be considered production-ready at all: scheduling blocking calls inside non-blocking threads can lead to unpredictable behaviour, at best!
To avoid this happening to you, you should strongly consider relying on a tool like BlockHound to detect blocking calls in reactive code.
How does it work?
BlockHound acts similarly to a java agent, a special little piece of software that gets loaded by the JVM before invoking the main entry point of your application and relies on the JVM Instrumentation API to orchestrate byte-code manipulation on classes and redefine their behaviour.
Once BlockHound gets bootstrapped, it marks a set of blocking methods that need to be altered (eg.Thread.sleep()
) and changes their behaviour so they’ll end up throwing an Error in case they get invoked from within a thread…