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

gracefully handle concurrent stream writes and cancellations #2624

Merged
merged 1 commit into from
Jun 24, 2020

Conversation

marten-seemann
Copy link
Member

If the complete slice passed to Stream.Write() is sent out, and the stream is canceled concurrently (either by calling Stream.CancelWrite()or by receiving a STOP_SENDING frame), we don't need to return an error for the Write() call.

This PR fixes #2593. What was happening in that test is the following: The client would send a GET request to the server. In some rare cases, the FIN is not bundled with the STREAM frame. The server then receives the HTTP request and writes the response. The HTTP handler returns before the FIN is received, and the server therefore calls CancelRead() on the stream, which sends a STOP_SENDING frame. The client then receives and processes the STOP_SENDING before the Write() call (that sent the request in the first place) had a chance to return.

If the complete slice passed to Stream.Write() is sent out, and the
stream is canceled concurrently (either by calling Stream.CancelWrite()
or by receiving a STOP_SENDING frame), we don't need to return an error
for the Write() call.
@codecov
Copy link

codecov bot commented Jun 24, 2020

Codecov Report

Merging #2624 into master will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2624      +/-   ##
==========================================
- Coverage   86.21%   86.20%   -0.01%     
==========================================
  Files         122      122              
  Lines        9775     9777       +2     
==========================================
+ Hits         8427     8428       +1     
- Misses       1004     1005       +1     
  Partials      344      344              
Impacted Files Coverage Δ
send_stream.go 93.24% <100.00%> (-0.31%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3289d2c...4ff3af3. Read the comment docs.

@marten-seemann marten-seemann merged commit 1607ace into master Jun 24, 2020
@marten-seemann marten-seemann deleted the concurrent-stream-write-and-cancelation branch June 24, 2020 08:19
@aschmahmann aschmahmann mentioned this pull request Sep 22, 2020
72 tasks
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.

failing HTTP test
2 participants