Skip to content

Conversation

@functioner
Copy link

(cherry picked from commit 7c1251d)

Author: Jie Huang <[email protected]>

Reviewers: [email protected], [email protected]

Closes apache#1116 from jhuan31/ZOOKEEPER-3575

(cherry picked from commit 7c1251d)
}

void writePacketNow(QuorumPacket pp, boolean flush) throws IOException {
synchronized (leaderOs) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THREAD_SAFETY_VIOLATION: Read/Write race. Non-private method Learner.writePacketNow(...) reads without synchronization from this.leaderOs. Potentially races with write in method Learner.connectToLeader(...).
Reporting because this access may occur on a background thread.
(at-me in a reply with help or ignore)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If learner.asyncSending is not set, all QuorumPacket will be sent in this writePacketNow method.
If learner.asyncSending is set, all QuorumPacket will be sent in the LearnerSender thread, which doesn't need the synchronization.
Therefore, there wouldn't be potential race.

@arshadmohammad
Copy link
Contributor

Please include the latest changes done in PR #1645.
Also add the documentation for learner.asyncSending property

@functioner
Copy link
Author

@arshadmohammad I cherry-pick #1645. Some configurations are not available in branch-3.6 so I do not include them.

@arshadmohammad
Copy link
Contributor

Other than minor import issues, changes Looks good to me. @functioner please correct the import

Copy link
Contributor

@arshadmohammad arshadmohammad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM +1

asfgit pushed a commit that referenced this pull request Mar 29, 2021
(cherry picked from commit 7c1251d)

Author: functioner <[email protected]>
Author: Ayush Mantri <[email protected]>
Author: Jie Huang <[email protected]>

Reviewers: Mohammad Arshad <[email protected]>

Closes #1653 from functioner/ZOOKEEPER-4260 and squashes the following commits:

0a19eb1 [functioner] remove useless import
5d827de [Ayush Mantri] cherry-pick ZOOKEEPER-4257 and fix conflicts
469d971 [functioner] Merge branch 'branch-3.6' of https://github.com/apache/zookeeper into ZOOKEEPER-4260
e6cb767 [Jie Huang] ZOOKEEPER-3575: Moving sending packets in Learner to a separate thread
@arshadmohammad
Copy link
Contributor

Merged

@functioner functioner deleted the ZOOKEEPER-4260 branch March 29, 2021 16:23
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