Github user lvfangmin commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/673#discussion_r227962259
--- Diff:
zookeeper-server/src/main/java/org/apache/zookeeper/server/ZooKeeperServer.java
---
@@ -1107,6 +1102,19 @@ public void processPacket(ServerCnxn cnxn,
ByteBuffer incomingBuffer) throws IOE
BinaryInputArchive bia = BinaryInputArchive.getArchive(bais);
RequestHeader h = new RequestHeader();
h.deserialize(bia, "header");
+
+ // Need to increase the outstanding request count first, otherwise
+ // there might be a race condition that it enabled recv after
+ // processing request and then disabled when check throttling.
+ //
+ // It changes the semantic a bit, since when check throttling it's
--- End diff --
That makes sense to me, it's hard to find out what's the previous behavior
is, I'll change it as what you suggested to.
---