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

Fix unsafe threadid indexing #16

Open
NHDaly opened this issue Jul 27, 2023 · 2 comments
Open

Fix unsafe threadid indexing #16

NHDaly opened this issue Jul 27, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@NHDaly
Copy link
Collaborator

NHDaly commented Jul 27, 2023

See: https://julialang.org/blog/2023/07/PSA-dont-use-threadid/

This is unsafe now that julia has the ability to add and remove threads dynamically; you may end up on a threadid that is out-of-bounds on the vector.

@NHDaly
Copy link
Collaborator Author

NHDaly commented Jul 27, 2023

@kpamnany suggests that the proper fix is to just shard your cache into several smaller caches.

The goal of having this split cache is just to reduce contention. You can do that with any key that shards the space; it doesn't need to be a threadid. For example, you can hash the taskid or shard by the keyspace itself, etc etc.

(Sharding by keyspace is what our similar cache that Todd wrote in RAICode does.)

@NHDaly NHDaly added the bug Something isn't working label Jul 27, 2023
@NHDaly
Copy link
Collaborator Author

NHDaly commented Jul 27, 2023

CC: @ttonelli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant