-
Notifications
You must be signed in to change notification settings - Fork 7
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
Double Posting in Hall of Fame #27
Comments
This is indeed a race condition, and occurs due to the fact that each time we receive an event (in this case, a reaction being added), we spawn a new thread. These (non-atomically) read the entire db of HoF'd posts, check if the given post is in it, and if not prepends it and posts an entry in the HoF channel. The issue here is that the file read and search operation is slow (and lazy), so if events come in fast enough we can effectively get a TOCTOU situation on our hands. The best way I can immediately think of to solve this is to store a semaphore for the file in an MVar to ensure we can atomically check for the entry's existence in the db. This could also be mitigated by keeping a copy of the db in an MVar also (which I plan to implement with the config/db system rewrite). |
Double posting in the Hall of Fame channel is becoming a very very frequent problem (1 in 2 at least), and I've been manually deleting many -- if it's a race condition, it's way too frequent and should be fixed immediately.
The text was updated successfully, but these errors were encountered: