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

bugfix: fix edge cases related to time atomicity #123

Closed
wants to merge 2 commits into from

Conversation

posborne
Copy link
Contributor

@posborne posborne commented Oct 3, 2019

These changes aim to make it so that calls to the public API
operate over the cache using a single Instant of time rather than
calling Instant::now() at several unique points in time during the
synchronous execution of the function.

The former execution model lead to potential bugs, notably in functions
like entry() as brought up in #122, especially on targets with less processing
power or under heavy load.

This also reduces the number of system calls that need to be made which
may improve performance for some use cases.

These changes aim to make it so that calls to the public API
operate over the cache using a single Instant of time rather than
calling Instant::now() at several unique points in time during the
synchronous execution of the function.

The former execution model lead to potential bugs, notably in functions
like entry() as brought up in maidsafe#122, especially on targets with less processing
power or under heavy load.

This also reduces the number of system calls that need to be made which
may improve performance for some use cases.

Signed-off-by: Paul Osborne <[email protected]>
@posborne posborne requested a review from ustulation as a code owner October 3, 2019 20:08
Under a heavy CPU load, time can elapse between insert/get_mut on an entry
which results in a panic.

Signed-off-by: Paul Osborne <[email protected]>
@posborne
Copy link
Contributor Author

posborne commented Dec 5, 2019

@ustulation Can I get a review on this; it should be noted that the cache implementation is fundamentally broken without some change.

@kosta
Copy link

kosta commented Feb 27, 2020

I'm a user of the lru_time_cache library and I would like to see this bug fixed.

I chose the lru_time_cache library due to its lack of unsound unsafe code. There's not that many lru caches in rust. Thank you for providing and maintaining it! I hope it's not rude to ping this issue after 3 months :)

@S-Coyle
Copy link
Contributor

S-Coyle commented Mar 20, 2020

Resolved by #126 , thanks to @calavera
New release to follow

@S-Coyle S-Coyle closed this Mar 20, 2020
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