-
Notifications
You must be signed in to change notification settings - Fork 43
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
Map Leaking entries... #109
Comments
Hi, Am I right in understanding that a "leak" means spuriously disappearing values, e.g. as if the value was garbage-collected? Are you able to tell which |
Correct. The key+value just disappears from the map.
It is not consistent - but the benchmark has some random elements. The IDs are starting from 1 and increasing. I have the logs from a run where ID 12844 disappears: These are the entries for the entry that goes missing:
The entry is stored like this - I added an extra load to see if it was actually stored:
The entry is loaded like this:
The delete also adds a Load to see if what we are deleting exists:
The entries are created pretty much in order, but deletes are somewhat less ordered. |
Good news. Looks like I'm able to reproduce the issue. Looking into the bug now: the bugfix may take some time, so please be patient. Once more, thanks a lot for reporting the issue! |
Thanks. I am not looking for a quick fix, since the workaround works fine and it isn't really critical to the current code path, as the CPU usage of other parts are much higher. Just thought it might be helpful to report. And TBH if someone had come with a similar claim with one of my packages, I'd 90% have dismissed it as "problem is somewhere in your code". |
Sorry about the non-specific, but I just spent 2 days chasing down a bug, which turned out to be a problem where entries are "leaked" from the maps.
I have tried making a standalone reproducer, but I have been unable to trace it down. Finally I just replaced it with a "dumb map[uint64]*value" with a mutex for operations. This doesn't leak entries.
It only leaks very rarely, and I've only seen it under high loads.
Init:
xsync.NewIntegerMapOfPresized[uint64, *muxClient](1000)
- value is never copied or anything similar.Functions used inside the test:
Naturally all operations are used on the map concurrently.
Functions not use while reproducing:
Observations:
LoadOrStore
.Sorry for the vagueness. I tried setting up a reproducer, but I was not able to do a standalone reproducer.
Using
github.com/puzpuzpuz/xsync/v2 v2.5.0
-go version go1.21.0 windows/amd64
.The text was updated successfully, but these errors were encountered: