Skip to content

A DatagramChannelTest now waits for writes#2905

Merged
glbrntt merged 1 commit into
apple:mainfrom
rnro:DatagramChannelTests_race
Oct 4, 2024
Merged

A DatagramChannelTest now waits for writes#2905
glbrntt merged 1 commit into
apple:mainfrom
rnro:DatagramChannelTests_race

Conversation

@rnro
Copy link
Copy Markdown
Contributor

@rnro rnro commented Oct 4, 2024

Motivation:

In DatagramChannelTests.testChannelCanReportWritableBufferedBytesWithDataLargerThanSendBuffer we assert that there are no buffered writable bytes immediately after a flush, however in some cases tests fail as this is not true.

We suspect that this is because in some situations the kernel can be slow to drain the write buffer leading to racey behavior.

Modifications:

Wait for writes to complete before asserting that the buffer is emptied.

Result:

Tests should be more deterministic.

@rnro rnro added the 🔨 semver/patch No public API change. label Oct 4, 2024
@rnro rnro force-pushed the DatagramChannelTests_race branch from 7a489d0 to 8f27db4 Compare October 4, 2024 09:59
@glbrntt glbrntt enabled auto-merge (squash) October 4, 2024 10:17
Motivation:

In
`DatagramChannelTests.testChannelCanReportWritableBufferedBytesWithDataLargerThanSendBuffer`
we assert that there are no buffered writable bytes immediately after a
flush, however in some cases tests fail as this is not true.

We suspect that this is because in some situations the kernel can be
slow to drain the write buffer leading to racey behavior.

Modifications:

Wait for writes to complete before asserting that the buffer is emptied.

Result:

Tests should be more deterministic.

Co-authored-by: Cory Benfield <[email protected]>
@rnro rnro force-pushed the DatagramChannelTests_race branch from 8f27db4 to a2f277a Compare October 4, 2024 10:19
@glbrntt glbrntt merged commit bee38df into apple:main Oct 4, 2024
@rnro rnro deleted the DatagramChannelTests_race branch October 4, 2024 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 semver/patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants