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

Is this library safe? #19

Open
martyall opened this issue May 1, 2024 · 0 comments
Open

Is this library safe? #19

martyall opened this issue May 1, 2024 · 0 comments

Comments

@martyall
Copy link

martyall commented May 1, 2024

I usually blindly trust anything with the name kmett attached, but I'm experiencing some behavior where distinct interned values come back with the same Id. I can verify that they belong to the same cache bucket (i.e. their modulus is the same wrt the cacheWidth) and that they have distinct hashes.

The setup for my work is open source but it's quite involved. I can share code if needed but looking for a high level answer first. I'm not an unsafePerformIO guru, but under what conditions is using intern safe? Are race conditions possible? Can compiler optimizations effect the outcome?

In fact, since this whole thing is predicated based on unique Int hashes, why have this Id be some formulaic incremented value instead of just using hash . describe ?

NOTE: When I stop using the formula based on current cache state for the Id and instead switch to hash . describe I dont have any more problems

@martyall martyall changed the title Is this library actually safe? Is this library safe? May 2, 2024
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

1 participant