Closed lolgesten closed 6 years ago
And I just had another crash running with my changes.
thread '<unnamed>' panicked at 'lru_key missing in store', libcore/option.rs:960:5
So it's the first unwrap() that falls over.
Weird... thanks a bunch for investigating this
I must have messed up some logic and there's duplicate keys present in the order
list
@lolgesten So there's a racy case - if a cached function is called twice for some long execution with the same key, the same key will be set in the cache twice and the key will be prepended to the order
list twice. Once these keys get pushed to the end and are evicted, we hit the panic trying to remove the same key from the hashmap twice.
I can put out a patch later tonight w/ a fix
@jaemk Brilliant! Thanks! Problem was a bit more complicated than my patch :P
I'm deploying this to our production servers now. The race happened quite infrequently for us, like once every 5 days. So definite confirmation will take time.
However i think we can close this issue since it seems very likely you fixed it.
@lolgesten Awesome - Thanks again for reporting and investigating this! Please re-open if the issue crops up again!
We're caching some results of looking up data in S3, and every few days we get a panic in cached that poisons the internal mutex.
Our cached definition is this:
The crash is this where cached is on line 9:
This is probably from one of these two rows:
https://github.com/jaemk/cached/blob/0ed46ce9d6754da572d38617547a7b6b421007a9/src/stores.rs#L124-L125
I guess one of these unwrap() assumptions doesn't hold true for us?