You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2022/11/02 05:37:51 UTC

[GitHub] [zookeeper] sonatype-lift[bot] commented on a diff in pull request #1942: ZOOKEEPER-4460: QuorumPeer overrides Thread.getId with different sema…

sonatype-lift[bot] commented on code in PR #1942:
URL: https://github.com/apache/zookeeper/pull/1942#discussion_r1011213870


##########
zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumCnxManager.java:
##########
@@ -510,12 +510,12 @@ private boolean startConnection(Socket sock, Long sid) throws IOException {
         }
 
         // If lost the challenge, then drop the new connection
-        if (sid > self.getId()) {
-            LOG.info("Have smaller server identifier, so dropping the connection: (myId:{} --> sid:{})", self.getId(), sid);
+        if (sid > self.getMyId()) {
+            LOG.info("Have smaller server identifier, so dropping the connection: (myId:{} --> sid:{})", self.getMyId(), sid);

Review Comment:
   *RESOURCE_LEAK:*  resource of type `java.io.DataInputStream` acquired by call to `new()` at line 498 is not released after line 514.
   
   ---
   
   <details><summary><b>ℹ️ Learn about @sonatype-lift commands</b></summary>
   
   You can reply with the following commands. For example, reply with ***@sonatype-lift ignoreall*** to leave out all findings.
   | **Command** | **Usage** |
   | ------------- | ------------- |
   | `@sonatype-lift ignore` | Leave out the above finding from this PR |
   | `@sonatype-lift ignoreall` | Leave out all the existing findings from this PR |
   | `@sonatype-lift exclude <file\|issue\|path\|tool>` | Exclude specified `file\|issue\|path\|tool` from Lift findings by updating your config.toml file |
   
   **Note:** When talking to LiftBot, you need to **refresh** the page to see its response.
   <sub>[Click here](https://github.com/apps/sonatype-lift/installations/new) to add LiftBot to another repo.</sub></details>
   
   
   
   ---
   
   Was this a good recommendation?
   [ [🙁 Not relevant](https://www.sonatype.com/lift-comment-rating?comment=350061542&lift_comment_rating=1) ] - [ [😕 Won't fix](https://www.sonatype.com/lift-comment-rating?comment=350061542&lift_comment_rating=2) ] - [ [😑 Not critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=350061542&lift_comment_rating=3) ] - [ [🙂 Critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=350061542&lift_comment_rating=4) ] - [ [😊 Critical, fixing now](https://www.sonatype.com/lift-comment-rating?comment=350061542&lift_comment_rating=5) ]



##########
zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Leader.java:
##########
@@ -658,13 +658,13 @@ void lead() throws IOException, InterruptedException {
             // us. We do this by waiting for the NEWLEADER packet to get
             // acknowledged
 
-            waitForEpochAck(self.getId(), leaderStateSummary);
+            waitForEpochAck(self.getMyId(), leaderStateSummary);

Review Comment:
   💬 2 similar findings have been found in this PR
   
   ---
   
   *THREAD_SAFETY_VIOLATION:*  Read/Write race. Non-private method `Leader.lead()` indirectly reads with synchronization from `this.leaderStateSummary`. Potentially races with unsynchronized write in method `Leader.lead()`.
    Reporting because this access may occur on a background thread.
   
   ---
   
   <details><summary><b>🔎 Expand here to view all instances of this finding</b></summary><br/>
   
   <div align="center">
   
   | **File Path** | **Line Number** |
   | ------------- | ------------- |
   | zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Leader.java | [606](https://github.com/cnauroth/zookeeper/blob/d3879db1ed019892373683694663b05ade0db6fe/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Leader.java#L606)|
   | zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Leader.java | [667](https://github.com/cnauroth/zookeeper/blob/d3879db1ed019892373683694663b05ade0db6fe/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Leader.java#L667)|
   <p><a href="https://lift.sonatype.com/results/github.com/apache/zookeeper/01GGVCXE6YD5J4DMW6NQ80YQMF?t=Infer|THREAD_SAFETY_VIOLATION" target="_blank">Visit the Lift Web Console</a> to find more details in your report.</p></div></details>
   
   
   
   ---
   
   <details><summary><b>ℹ️ Learn about @sonatype-lift commands</b></summary>
   
   You can reply with the following commands. For example, reply with ***@sonatype-lift ignoreall*** to leave out all findings.
   | **Command** | **Usage** |
   | ------------- | ------------- |
   | `@sonatype-lift ignore` | Leave out the above finding from this PR |
   | `@sonatype-lift ignoreall` | Leave out all the existing findings from this PR |
   | `@sonatype-lift exclude <file\|issue\|path\|tool>` | Exclude specified `file\|issue\|path\|tool` from Lift findings by updating your config.toml file |
   
   **Note:** When talking to LiftBot, you need to **refresh** the page to see its response.
   <sub>[Click here](https://github.com/apps/sonatype-lift/installations/new) to add LiftBot to another repo.</sub></details>
   
   
   
   ---
   
   Was this a good recommendation?
   [ [🙁 Not relevant](https://www.sonatype.com/lift-comment-rating?comment=350061670&lift_comment_rating=1) ] - [ [😕 Won't fix](https://www.sonatype.com/lift-comment-rating?comment=350061670&lift_comment_rating=2) ] - [ [😑 Not critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=350061670&lift_comment_rating=3) ] - [ [🙂 Critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=350061670&lift_comment_rating=4) ] - [ [😊 Critical, fixing now](https://www.sonatype.com/lift-comment-rating?comment=350061670&lift_comment_rating=5) ]



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org