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 tests #113

Merged
merged 3 commits into from
Feb 6, 2020
Merged

Fix/flaky tests #113

merged 3 commits into from
Feb 6, 2020

Conversation

hannahhoward
Copy link
Collaborator

Goals

Fix our tests, discover underlying bugs

Implementation

So I have discovered the source of at least one bug. When unmarshalling CBOR, the generated cbor-gen Unmarshallers call cbg.GetPeeker(r) which returns a new buffered reader, unless it is passed a reader that is already buffered. This buffered reader reads 16 bytes at a time from the network stream. So, if two responses end up in the stream ahead of each other, it will read extra bytes from the first. However, those bytes will be lost from the underlying reader when we come back to read the second response. The solution is to maintain a buffered reader at the stream level, so that buffered data is preserved between reads. I have verified this seems to resolve our integration test failures. It is an expected and conceivable behavior that the retrieval protocol could write two responses on the server before the client reads the first.

Fix issues with buffered io on multiple writes to a stream
Fix issues with buffered io on multiple writes to a stream
Copy link
Contributor

@shannonwells shannonwells left a comment

Choose a reason for hiding this comment

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

LGTM, pretty simple solution. Thanks.

Copy link
Contributor

@shannonwells shannonwells left a comment

Choose a reason for hiding this comment

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

approved

@hannahhoward hannahhoward merged commit 64f1663 into master Feb 6, 2020
@codecov-io
Copy link

codecov-io commented Feb 6, 2020

Codecov Report

Merging #113 into master will increase coverage by 0.18%.
The diff coverage is 66.67%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #113      +/-   ##
==========================================
+ Coverage   38.15%   38.33%   +0.18%     
==========================================
  Files          41       41              
  Lines        2797     2805       +8     
==========================================
+ Hits         1067     1075       +8     
  Misses       1506     1506              
  Partials      224      224
Impacted Files Coverage Δ
retrievalmarket/network/query_stream.go 66.67% <0%> (ø) ⬆️
storagemarket/network/deal_stream.go 63.16% <0%> (ø) ⬆️
storagemarket/network/ask_stream.go 66.67% <0%> (ø) ⬆️
retrievalmarket/network/deal_stream.go 70.84% <0%> (ø) ⬆️
storagemarket/network/libp2p_impl.go 76.75% <100%> (+2.39%) ⬆️
retrievalmarket/network/libp2p_impl.go 76.75% <100%> (+2.39%) ⬆️

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 aa23f79...1481567. Read the comment docs.

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.

3 participants