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

Technically torn reads can succeed #3

Closed
mtak- opened this issue Mar 18, 2019 · 2 comments
Closed

Technically torn reads can succeed #3

mtak- opened this issue Mar 18, 2019 · 2 comments

Comments

@mtak-
Copy link

mtak- commented Mar 18, 2019

This is a ridiculous corner case.

Thread 1:
Starts a read, getting a sequence number, and reads some of the data.

Other threads:
Successfully perform exactly 2^(mem::size_of::<usize>() - 1) writes, leaving the sequence number effectively unchanged.

Thread 1:
Finishes reading the data, and sees the sequence number unchanged. It then returns the torn read.

On 64-bit machines, this would take a few lifetimes to occur, on 32-bit machines it might require the reader thread to be inactive for around one second.

@Amanieu
Copy link
Owner

Amanieu commented Mar 18, 2019

Yes, this is a known issue with seqlock. However the probability of hitting this is so low that it may as well be non-existent.

@mtak-
Copy link
Author

mtak- commented Mar 20, 2019

That makes sense. Thanks for checking this out. I'll go ahead and close this issue.

@mtak- mtak- closed this as completed Mar 20, 2019
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

No branches or pull requests

2 participants