Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky URLConnectionTest.serverShutdownOutput test #4469

Merged
merged 1 commit into from
Dec 25, 2018

Conversation

amirlivneh
Copy link
Collaborator

There are usually 2 requests sent to '/b' during the test:
#1 on the busted connection, attempting reuse
#2 on a new connection

On successful runs, the server recorded #1 and then #2 and added them to the queue in that order.

On failed runs, the server started reading request #1 before #2, but there was a context switch, and it finished reading #2 before #1, recording them in that order. Since #1 was the last to be recorded, the test incorrectly used it to assert that the sequence number was 0. Since #1 was the second to be received on the busted connection, it had a sequence number of 1 so the test failed.

The fix removes the assumption that #2 is the last to be recorded.

Fixes #4140.

There are usually 2 requests sent to '/b' during the test:
square#1 on the busted connection, attempting reuse
square#2 on a new connection

On successful runs, the server recorded square#1 and then square#2 and added them to the queue in that order.

On failed runs, the server started reading request square#1 before square#2, but there was a context switch, and it finished reading square#2 before square#1, recording them in that order. Since square#1 was the last to be recorded, the test incorrectly used it to assert that the sequence number was 0. Since square#1 was the second to be received on the busted connection, it had a sequence number of 1 so the test failed.

The fix removes the assumption that square#2 is the last to be recorded.

Fixes square#4140.
@swankjesse
Copy link
Collaborator

Nice sleuthing!

@swankjesse swankjesse merged commit 389d9aa into square:master Dec 25, 2018
@amirlivneh amirlivneh deleted the fix-servershutdownoutput-test branch December 25, 2018 12:46
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.

URLConnectionTest.testServerClosesOutput is flaky
2 participants