Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix race condition in #2536 #2537

Closed

Conversation

einarmo
Copy link

@einarmo einarmo commented Sep 3, 2024

This fixes a race condition in BsonMapper (#2536), caused by a fix to a different issue in #2493.

It seems like the current approach of checking the dictionary twice is deliberate, likely for performance reasons. That said, I don't believe reading from a dictionary that may be in the process of being updated is actually safe to begin with.

If this is unacceptable perf-wise I believe the locking must be swapped with a proper read-write lock.

This fixes a race condition in BsonMapper, caused by a fix to a
different issue in litedb-org#2493.

It seems like the current approach of checking the dictionary twice is
deliberate. That said, I don't believe reading from a dictionary
that may be in the process of being updated is actually safe to begin
with.
@einarmo
Copy link
Author

einarmo commented Sep 27, 2024

Closing in favor of #2538

@einarmo einarmo closed this Sep 27, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant