Draft: 8386985: PacketSpaceManagerTest failed with AssertionError; A race condition may cause packetSent to mistakenly skip rescheduling of the transmitter task#31662
Open
dfuch wants to merge 1 commit into
Conversation
…ndition may cause packetSent to mistakenly skip rescheduling of the transmitter task
|
👋 Welcome back dfuchs! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
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.
The issue was observed on a local run in PacketSpaceManagerTest:
org.opentest4j.AssertionFailedError: nextDeadline should not be after 250ms from now! ==> expected: but was:
at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
at org.junit.jupiter.api.AssertFalse.failNotFalse(AssertFalse.java:63)
at org.junit.jupiter.api.AssertFalse.assertFalse(AssertFalse.java:36)
at org.junit.jupiter.api.Assertions.assertFalse(Assertions.java:239)
at PacketSpaceManagerTest$SynchronousTestDriver.run(PacketSpaceManagerTest.java:856)
Investigation suggests that this caused by a race condition where
packetSentwas invoked while the transmitter task was running:packetSentwill only reschedule the transmitter if there is no deadline, that is, if it observes thatdeadline == Deadline.MAX; But ifdeadlineis already in the past, which is typically the case when the transmitter task is running, then there's no guarantee that the transmitter task will actually end up rescheduling itself with a new deadline. It may not if it thinks there is nothing pending. The transmitter will then remain unscheduled until something else happens that causes it to be rescheduled. In a typical HTTP/3 request/response exchange chances are high that "something else" will happen, which explains why even ifpacketSentfails to rescedule, there might not be any observable consequence (outside of PacketSpaceManagerTest). However, there is no guarantee.The fix is to always call PacketSpaceManager::reschedule, which will compute a new prospective deadline which the timer queue can reliably use to decide whether the selector should be woken up to take into account the new deadline.
A new testPacketSent() test that deterministically fails without the fix is added to PacketSpaceManagerTest.
Progress
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/31662/head:pull/31662$ git checkout pull/31662Update a local copy of the PR:
$ git checkout pull/31662$ git pull https://git.openjdk.org/jdk.git pull/31662/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 31662View PR using the GUI difftool:
$ git pr show -t 31662Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/31662.diff