Open
Conversation
added 2 commits
February 5, 2026 11:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JAVA-6071
This ticket involves two separate bugs in a test case
testBulkWriteHandlesWriteErrorsAcrossBatchesfor reactive driver , specifically whenorderedfield is falseIllegalState exception on Mono Timeout
The first part of the failed test is
Here is the link to the build
Here is the log that caught my attention
As you can see the time diff between two last logs is exactly two minutes , and according to our settings, the sync driver blocks mono by two minutes
So timeout happened and
Mono.blockthrewIllegalStateExceptionThis PR does not solve this issue, the
IllegalStateis expected, unless we want to override timeout for this test case only as it deals with a huge number of documents per batchConnection leak
Second asserting that failed on this test case is connection leak
Before looking at at the leak, I started checking what the test case is actually doing I noticed that it tries to insert documents in batches of 10K invalid(duplicate ids) docs per batch
The assertion that happens for connection leak happens here
The code is running a loop which fails after 2 seconds if not all connections are closed, in my local env I noticed that 2 seconds is not enough for such a huge number of documents to be processed so I introduced a new method that can propagate and override this timeout, after running this test case 100 times locally I didn't notice the connection leak anymore
To test it locally
IllegalStateExceptionRepeatedTestto this test case, in my case , I hardcodedordered=falseinstead of relying on parametrized test so that I can useRepeatedTestNullPointerException
The last part of this failed test is NullPointer here
The exception makes sense;
hasRemaining()throws an NPE because the underlying buffer becomes null once released. While I couldn't reproduce this after 100 local test runs, I added a guard forByteBufNIO. By usingasNio()first (which acts as a direct getter forByteBufNIObut avoids the buffer copying found in Netty or other implementations), we can safely check if the underlying buffer is null before checkinghasRemaining, for other implementation we still rely onhasRemainingI don't like this approach because of abstraction leak and open for any suggestions