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 2020/10/07 22:03:43 UTC

[GitHub] [zookeeper] belugabehr opened a new pull request #1490: ZOOKEEPER-3963: Revamp and Log Connection Disconnect Reason

belugabehr opened a new pull request #1490:
URL: https://github.com/apache/zookeeper/pull/1490


   


----------------------------------------------------------------
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.

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



[GitHub] [zookeeper] muse-dev[bot] commented on a change in pull request #1490: ZOOKEEPER-3963: Revamp and Log Connection Disconnect Reason

Posted by GitBox <gi...@apache.org>.
muse-dev[bot] commented on a change in pull request #1490:
URL: https://github.com/apache/zookeeper/pull/1490#discussion_r501339454



##########
File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/ServerCnxn.java
##########
@@ -415,6 +416,14 @@ protected long incrPacketsSent() {
         return packetsSent.incrementAndGet();
     }
 
+    public DisconnectReason getDisconnectReason() {
+      return disconnectReason.orElse(DisconnectReason.UNKNOWN);

Review comment:
       *THREAD_SAFETY_VIOLATION:*  Read/Write race. Non-private method `ServerCnxn.getDisconnectReason()` reads without synchronization from `this.disconnectReason`. Potentially races with write in method `ServerCnxn.resetStats()`.
    Reporting because another access to the same memory occurs on a background thread, although this access may not.

##########
File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/ServerCnxn.java
##########
@@ -415,6 +416,14 @@ protected long incrPacketsSent() {
         return packetsSent.incrementAndGet();
     }
 
+    public DisconnectReason getDisconnectReason() {
+      return disconnectReason.orElse(DisconnectReason.UNKNOWN);
+    }
+
+    protected void setDisconnectReason(DisconnectReason disconnectReason) {
+      this.disconnectReason = Optional.ofNullable(disconnectReason);

Review comment:
       *THREAD_SAFETY_VIOLATION:*  Unprotected write. Non-private method `ServerCnxn.setDisconnectReason(...)` writes to field `this.disconnectReason` outside of synchronization.
    Reporting because another access to the same memory occurs on a background thread, although this access may not.




----------------------------------------------------------------
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.

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