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 panic introduced by OStream optimization #1437

Merged
merged 5 commits into from
Mar 11, 2019
Merged

Conversation

richardartoul
Copy link
Contributor

@richardartoul richardartoul commented Mar 8, 2019

A panic was introduced by #1399 that can occur when many reads are happening in parallel for the same series. The panic occurs because the previous P.R introduced a called to Reset() on a checked.Bytes on the read path.

The read path is only protected by an RLock so this would be interpreted by the checked.Bytes as a double write and cause a panic. Technically no double write was taking place because the second called to Reset would be a no-op, but the checked.Bytes has no way to distinguish that and we shouldn't be doing any mutation on the read path anyways.

This P.R updates the code path so that the call to RawBytes actually just returns []byte instead of checked.Bytes. This avoids the issue of performing a mutation on the read path entirely.

I've also included a regression test which would have caught the issue.

@richardartoul richardartoul force-pushed the ra/fix-panic branch 2 times, most recently from 85f11c9 to 794654c Compare March 8, 2019 19:24
Copy link
Contributor

@simonrobb simonrobb left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Collaborator

@robskillington robskillington left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov
Copy link

codecov bot commented Mar 11, 2019

Codecov Report

Merging #1437 into master will increase coverage by <.1%.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #1437     +/-   ##
========================================
+ Coverage    70.9%   70.9%   +<.1%     
========================================
  Files         836     836             
  Lines       71507   71507             
========================================
+ Hits        50706   50714      +8     
+ Misses      17507   17497     -10     
- Partials     3294    3296      +2
Flag Coverage Δ
#aggregator 82.3% <ø> (ø) ⬆️
#cluster 85.8% <ø> (-0.1%) ⬇️
#collector 63.7% <ø> (ø) ⬆️
#dbnode 80.8% <100%> (ø) ⬆️
#m3em 73.2% <ø> (ø) ⬆️
#m3ninx 74.2% <ø> (ø) ⬆️
#m3nsch 51.1% <ø> (ø) ⬆️
#metrics 17.6% <ø> (ø) ⬆️
#msg 74.9% <ø> (ø) ⬆️
#query 65.8% <ø> (-0.1%) ⬇️
#x 76% <ø> (ø) ⬆️

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 b3cf54e...809dcc4. Read the comment docs.

@richardartoul richardartoul merged commit 7143653 into master Mar 11, 2019
@justinjc justinjc deleted the ra/fix-panic branch June 17, 2019 21:57
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