Skip to content

Allow marking a thread as blocking via a predicate #516

@minwoox

Description

@minwoox

Motivation

Our test suite uses an embedded Vert.x server:
https://github.com/fabric8io/kubernetes-client/blob/main/junit/mockwebserver/src/main/java/io/fabric8/mockwebserver/MockWebServer.java#L83

Vert.x utilizes FastThreadLocalThread for its blocking worker threads:

However, Netty's BlockHoundIntegration classifies FastThreadLocalThread as non-blocking by default:
https://github.com/netty/netty/blob/4.2/common/src/main/java/io/netty/util/internal/Hidden.java#L189

This results in Vert.x’s blocking threads being incorrectly treated as non-blocking by BlockHound. Currently:

  • There's no way to exclude or override the classification made by a third-party integration.
  • While we can add custom non-blocking thread predicates, we cannot force-mark specific threads as blocking.

Suggestion

Introduce a method like BlockHound.Builder.blockingThreadPredicate(...) to allow users to explicitly mark certain threads as blocking, even if third-party integrations consider them non-blocking.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions