Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
0.23.0
-
None
Description
The connection uses an AtomicBoolean and a volatile field to track the [first] exception leading to the connection being marked failed. The dual values aren't handled correctly, with the boolean tripped before the cause is recorded, and so concurrent use of them to throw an exception as actions are undertaken on the connection are unsafe, with potential for an NPE to occur instead of the intended exception being thrown. The exception field use is also probably unsafe in regards to its intent to contain the first failure.
The issues can be avoided by using an AtomicReference to track the detail instead, as other resources like producer+consumer already do.