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: event handler methods are not thread-safe #329

Merged
merged 1 commit into from
May 2, 2024

Conversation

federicobond
Copy link
Member

@federicobond federicobond commented May 2, 2024

The _client_handlers dictionary allowed modifications during iteration without proper concurrency control. I added some reentrant locks to manage concurrent access to the _global_handlers and _client_handlers data structures.

See #326

Perhaps there is a way to implement some finer-grained concurrency control? The Java SDK uses a ConcurrentHashMap that allows retrieval operations without locking, but I haven't looked into the details.

The _client_handlers dictionary allowed modifications during iteration
without proper concurrency control. I added some reentrant locks to manage
concurrent access to the _global_handlers and _client_handlers data
structures.

See open-feature#326

Signed-off-by: Federico Bond <federicobond@gmail.com>
Copy link

codecov bot commented May 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.41%. Comparing base (c3ad697) to head (3427796).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #329      +/-   ##
==========================================
+ Coverage   97.34%   97.41%   +0.07%     
==========================================
  Files          26       26              
  Lines        1206     1240      +34     
==========================================
+ Hits         1174     1208      +34     
  Misses         32       32              
Flag Coverage Δ
unittests 97.41% <100.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@federicobond federicobond merged commit 3217575 into open-feature:main May 2, 2024
13 checks passed
@federicobond federicobond deleted the dict-iter-bug branch May 2, 2024 14:42
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

Successfully merging this pull request may close these issues.

3 participants