Skip to content

Conversation

vbabanin
Copy link
Member

final CommandEventSender commandEventSender, final boolean responseExpected) {
List<ByteBuf> byteBuffers = bsonOutput.getByteBuffers();

boolean[] shouldReturn = {false};
Copy link
Member Author

@vbabanin vbabanin May 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've moved this check from "after the write is complete" to "before a message is send."

According to the CSOT spec:

After wire message construction, drivers MUST check for timeout before writing the message to the server.

CommandEventSender commandEventSender;

try (ByteBufferBsonOutput bsonOutput = new ByteBufferBsonOutput(this)) {
Timeout.onExistsAndExpired(operationContext.getTimeoutContext().timeoutIncludingRoundTrip(), () -> {
Copy link
Member Author

@vbabanin vbabanin May 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the specification:

After wire message construction, drivers MUST check for timeout before writing the message to the server.

I have removed this check from its previous position as it was occurring before the wire message was constructed, not after, which is contrary to the spec. We still perform this necessary timeout check later in the code within the trySendMessage method, just before writing the message to the socket.

@vbabanin vbabanin requested a review from rozza May 15, 2024 01:52
@vbabanin vbabanin marked this pull request as ready for review May 15, 2024 03:14
Copy link
Member

@rozza rozza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vbabanin vbabanin merged commit 0d2d8e8 into mongodb:CSOT May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants