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(pkg/counter): finish making counter atomic (#3276) #3283

Closed
wants to merge 1 commit into from
Closed

fix(pkg/counter): finish making counter atomic (#3276) #3283

wants to merge 1 commit into from

Commits on Jun 28, 2023

  1. fix(pkg/counter): finish making counter atomic (#3276)

    Last changes renamed Increment/Decrement to Increase/Decrease. This was
    reverted after discussions.
    
    With this new approach:
    
    - Overflow is detected in both cases (and proved by test).
    - Thread safety is guaranteed by atomic Add/Sub operations.
    - Unit tests prove all assumptions and thread safety for all cases.
    - Benchmark tests can be used to test other approaches in the future.
    - Overflow of a sum of all given arguments isn't detected (avoid overhead).
    
    NOTE: The issue is now fully fixed...
    
    Originally, the bug was only about reading counter value in parallel to
    atomic operation (multiple LOAD/STORE simultaneously, and some not
    protected by atomics).
    
    Previous fix, made by commit 1e54ce2, fixed data race but overflow errors
    could be reported more than once. It also had atomic operations for each
    given argument (if multiple arguments).
    
    This version addresses all concerns.
    
    commit: 0b97409 (main), cherry-pick
    rafaeldtinoco committed Jun 28, 2023
    Configuration menu
    Copy the full SHA
    e36b559 View commit details
    Browse the repository at this point in the history