BlockHound integration

Description

The driver claims to be "fully non-blocking" if only asynchronous execution is used, but when BlockHound is enabled, a few blocking calls are detected:

  1. com.datastax.oss.driver.internal.core.time.Clock#getInstance when JNI is activated

  2. com.datastax.oss.driver.internal.core.context.DefaultNettyOption: constructor and onClose method, because of HashedWheelTimer, see https://github.com/netty/netty/pull/10810.

  3. com.datastax.oss.driver.api.core.uuid.Uuids#random, this will be solved by JAVA-2449.

Also, BlockHound considers ReentrantLock.lock() as a blocking call, and several driver components are affected.

We should clarify what calls are really dangerous for non-blocking applications:

  1. Add a page to the manual to clarify how to use BlockHound and what API methods are safe to use;

  2. Add some BlockHound exceptions to methods that should always be allowed to block momentarily:

    1. Session Initialization participants should be allowed to block

    2. Calls to ReentrantLock.lock should be allowed where absolutely required for the driver to work properly, and expected lock contention is low (i.e. the thread won't be blocked indefinitely).

Environment

None

Pull Requests

None

Activity

Fixed

Details

Assignee

Reporter

Fix versions

Priority

Created November 20, 2020 at 10:12 AM
Updated December 18, 2020 at 6:04 PM
Resolved December 18, 2020 at 6:04 PM

Flag notifications