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

[query] Fix data race in FASTA reader #9427

Merged
merged 1 commit into from Sep 10, 2020

Conversation

chrisvittal
Copy link
Collaborator

In readBlock, membership was checked in a LinkedHashMap, then if it was
found, the value was retrieved from the cache. This lead to a data race
where a value could be evicted between the check and retrival. The
solution is to grab the block value out of the map, and if it is not
null, return it, otherwise, grab the block string, put it in the map,
and return it.

Co-authored-by: Tim Poterba tpoterba@broadinstitute.org

In readBlock, membership was checked in a LinkedHashMap, then if it was
found, the value was retrieved from the cache. This lead to a data race
where a value could be evicted between the check and retrival. The
solution is to grab the block value out of the map, and if it is not
null, return it, otherwise, grab the block string, put it in the map,
and return it.

Co-authored-by: Tim Poterba <tpoterba@broadinstitute.org>
@tpoterba
Copy link
Contributor

tpoterba commented Sep 9, 2020

Did you run on dataproc? Could you replicate either the NPE or ClosedChannelException?

@chrisvittal
Copy link
Collaborator Author

The NPE, no. ClosedChannel, again, no.

@chrisvittal
Copy link
Collaborator Author

I did run it on Dataproc.

@tpoterba
Copy link
Contributor

huh, weird. So we maybe don't expect this to fix Julia's issue?

@chrisvittal
Copy link
Collaborator Author

I'm worried it's some other weird IO bug, but this should still fix the data race.

@danking danking merged commit c50b962 into hail-is:main Sep 10, 2020
pwc2 pushed a commit to pwc2/hail that referenced this pull request Sep 21, 2020
In readBlock, membership was checked in a LinkedHashMap, then if it was
found, the value was retrieved from the cache. This lead to a data race
where a value could be evicted between the check and retrival. The
solution is to grab the block value out of the map, and if it is not
null, return it, otherwise, grab the block string, put it in the map,
and return it.

Co-authored-by: Tim Poterba <tpoterba@broadinstitute.org>

Co-authored-by: Tim Poterba <tpoterba@broadinstitute.org>
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.

None yet

4 participants