Github user joshelser commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/186#discussion_r104792592
--- Diff:
src/java/main/org/apache/zookeeper/server/NettyServerCnxnFactory.java ---
@@ -162,7 +162,7 @@ public void messageReceived(ChannelHandlerContext ctx,
MessageEvent e)
+ " from " + ctx.getChannel());
}
NettyServerCnxn cnxn =
(NettyServerCnxn)ctx.getAttachment();
- synchronized(cnxn) {
+ synchronized(cnxn.getRpcLock()) {
processMessage(e, cnxn);
--- End diff --
> Now one thread can be in processMessage while another thread is getting
stats about the connection. Is that ok?
I believe this is OK. We can receive two concurrent `stat` commands, but we
only process one of them at a time. I'm also not a Netty wizard, so I could be
wildly wrong :)
> Basically I am wondering if there is any other code out there that should
now sync on what getRpcLock() returns.
That's a good point. I had looked to see that there were multiple other
methods in `ServerCnxn` which were also synchronized (thus, changing
`dumpConnectionInfo(..)` wouldn't have been sufficient). I didn't look to see
if there's another code-path which is also synchronizing on the
`NettyServerCnxn` (or `ServerCnxn`).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---