BlockHound | Java agent to detect blocking calls from non-blocking threads | Monitoring library
kandi X-RAY | BlockHound Summary
kandi X-RAY | BlockHound Summary
Java agent to detect blocking calls from non-blocking threads.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Returns a string representation of this class
- Returns true if the field is static
- Gets the modifiers
- Performs a non - blocking call
- Returns a runnable that runs multiple times
- Allows a blocking call to support blocking calls
- Blocking call
- Installs the BlockHound integrations
- Creates a new BlockHound
- Performs a baseline benchmark with a blocking call
- Performs a baseline benchmark
- This benchmark measures a blocking call
- Benchmarking call in blocking mode
- Inject bootstrap classes
- Transform class to byte array
- Apply a filter to a BlockHound
- Apply standard output to standard output stream
- Measure the calling call in blocking mode
- Apply blocking call to the BlockHound
- Transforms the given TypeDescriptor into a DynamicTypeBuilder
- Check if method is blocking
- Interprets the given type
- Apply the filter to the builder
- Non blocking call
BlockHound Key Features
BlockHound Examples and Code Snippets
Community Discussions
Trending Discussions on BlockHound
QUESTION
I have some App with WebFlux and i want to use BlockHound, but i need to have a possible turn on and off it through parameter in application.properties or through spring profiling or somthing else. Also I want to override action, when the lock operation is caught so that not throw error but log warning. And firstly, i did through parameter in application.properties:
...ANSWER
Answered 2022-Mar-23 at 08:33I resolve it. Maybe someone it will be useful. I did it through profiling and my code bellow:
QUESTION
I have below tech stack for a spring amqp application consuming messages from rabbitmq -
...ANSWER
Answered 2022-Mar-08 at 11:52Sorry, just realized that the flatMap in parallel flux call was actually like below
QUESTION
I'm having trouble packaging my project using jpackage by badass jlink plugin. Project contains Spring Boot
, which works with JavaFX
via FXVeawer
. And with Spring Data
application works with Database.
My build.gradle
:
ANSWER
Answered 2022-Mar-04 at 09:03Explaining the error
QUESTION
We run spring-boot containers created using bootBuildImage gradle task on kubernetes. We provide both CPU limits and memory limits to the pods at startup in k8s. We use:
- spring-boot version 2.6.2
- docker image built with gradle spring-boot plugin bootBuildImage task
- spring-boot-admin to administrate our spring-boot based deployments
- JDK 11 (to enable blockhound)
- 32 CPUs hosts in GCP GKE
- In dev we limit our container to 1 CPU and 1Gig of memory
We noticed that all our spring-boot based containers are provisioned (ie nb of threads) as if running on 32 CPUs instances.
Docker startup logs show
Setting Active Processor Count to 32
[...]
Picked up JAVA_TOOL_OPTIONS: [...] -XX:ActiveProcessorCount=32
In spring-boot-admin with see web servers (netty for reactive, undertow for servlet) are provisioned with thread pools as if the application was running on 32 CPUs allocated container even if the container was limited with 1 CPU by k8s. OTH the allocated memory to the JVM is correct.
How can we make sure the active CPU count reflects the k8s CPU limitation ?
Thanks in advance
...ANSWER
Answered 2022-Jan-08 at 13:55Based on the output you included, it looks like you're using buildpacks (i.e. ./mvnw spring-boot:build-image
or ./gradlew bootBuildImage
or pack build
).
In that case, you can set the env variable JAVA_TOOL_OPTIONS
with -XX:ActiveProcessorCount=x
to override the default calculation. The default calculation will pull the total number of processors (as reported by Go's runtime.NumCPU()
function).
Side note. What you are asking seems reasonable, so I opened an issue to see if we can enable it to detect the limited CPU count.
QUESTION
Using spring boot webflux, I'm trying Blockhound for a very simple blocking call, but it doesn't seem to be detecting it.
...ANSWER
Answered 2021-Jul-10 at 21:13Nothing is wrong here, you've just hit a corner case.
Mono.just()
is a rather special kind of Mono
in more ways than one (which is why I despair at its use in so many simple "getting started" style examples, but I digress) - since you're literally just wrapping a value inside a dummy publisher, it never needs to block in order to return its value, even if you call the block method. The method name might imply you're blocking, but you can trivially verify from the source code that it just returns a value. There's therefore no blocking operation occurring, and so nothing for Blockhound to complain about.
If you were to add another operator in the mix, even if it has no real-world effect:
String a = Mono.just("block").cache().block();
...then you'll see Blockhound start complaining, as you're no longer directly using the special case of MonoJust
.
Blockhound is doing exactly what it should here, the issue is that you're (very understandably) expecting something to block which doesn't.
QUESTION
This is what my pom.xml looks like
...ANSWER
Answered 2021-Mar-15 at 04:35The BOM dependency should go in the section
QUESTION
It is a well known fact Spring Webflux applications should not be blocking applications.
Was just wondering, is the app considered as blocking application, if there is a blocking call on start up, but no blocking call on business logic? Just a general question.
I have an example, (super easy to reproduce) where I am using Blockhound in order to test if the app is blocking. While instantiating Bloudhound in my unit and integration tests, the flow has been proven non blocking (very happy).
However, with a Blockhound instantiated on start up, Spring Webflux + Reactive Cassandra like this:
...ANSWER
Answered 2020-Dec-12 at 23:54Official response from Datastax team:
The error is happening when Spring is building the application context, which happens when the application starts. Blocking calls are usually allowed during this phase, even for reactive / non-blocking applications – otherwise, your application would be totally unable to read a config file, for instance – since this is a blocking call.
Actively working on JAVA-2449 right now. I will change Uuids.random() to use non-blocking stuff.
QUESTION
I am profiling my reactor application using BlockHound
. I have a filter on my ExchangeFunction
:
ANSWER
Answered 2020-Jun-24 at 16:28According to your gist, BlockHound is detecting java.io.FileInputStream.readBytes(..)
as blocking deep within the SSL handshake.
This problem has been reported in https://github.com/reactor/reactor-netty/issues/939 and appears to be resolved in the latest releases.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install BlockHound
You can use BlockHound like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the BlockHound component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page