zookeeper-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [zookeeper] muse-dev[bot] commented on a change in pull request #1490: ZOOKEEPER-3963: Revamp and Log Connection Disconnect Reason
Date Wed, 07 Oct 2020 22:12:55 GMT

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



Mime
View raw message