Skip to content

[fix][txn] Fix PendingAckHandleImpl potential thread safety issue #22166

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dao-jun
Copy link
Member

@dao-jun dao-jun commented Feb 29, 2024

Fixes #21304

Main Issue: #xyz

PIP: #xyz

Motivation

Fix PendingAckHandleImpl potential thread safety issue

Modifications

  1. Make all the access operations to individualAckOfTransaction is sync scope.
  2. For MutablePair, make all the access operations in a single thread except checkPositionInPendingAckState, 'cause the method is for Admin API
  3. Make individualAckOfTransaction, individualAckPositions volatile to prevent potential visibility issues
  4. Use internalPinnedExecutor to prevent blocking bk client thread.

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: dao-jun#10

@dao-jun dao-jun requested a review from lhotari February 29, 2024 14:54
@dao-jun dao-jun self-assigned this Feb 29, 2024
@dao-jun dao-jun added type/bug The PR fixed a bug or issue reported a bug area/transaction labels Feb 29, 2024
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Feb 29, 2024
@dao-jun dao-jun closed this Feb 29, 2024
@dao-jun dao-jun reopened this Feb 29, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.57%. Comparing base (bbc6224) to head (f9fc88b).
Report is 19 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #22166      +/-   ##
============================================
- Coverage     73.57%   73.57%   -0.01%     
- Complexity    32624    32638      +14     
============================================
  Files          1877     1877              
  Lines        139502   139577      +75     
  Branches      15299    15316      +17     
============================================
+ Hits         102638   102690      +52     
+ Misses        28908    28906       -2     
- Partials       7956     7981      +25     
Flag Coverage Δ
inttests 26.64% <71.42%> (+2.06%) ⬆️
systests 24.26% <0.00%> (-0.06%) ⬇️
unittests 72.83% <100.00%> (-0.02%) ⬇️

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

Files Coverage Δ
...nsaction/pendingack/impl/PendingAckHandleImpl.java 70.84% <100.00%> (ø)

... and 56 files with indirect coverage changes

@dao-jun dao-jun added this to the 3.3.0 milestone Mar 3, 2024
@coderzc coderzc modified the milestones: 3.3.0, 3.4.0 May 8, 2024
@lhotari lhotari modified the milestones: 4.0.0, 4.1.0 Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/transaction doc-not-needed Your PR changes do not impact docs ready-to-test release/4.0.5 type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task] Fix thread safety of PendingAckHandleImpl
4 participants