[ https://issues.apache.org/jira/browse/ZOOKEEPER-2847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16626485#comment-16626485 ]
Michael Han commented on ZOOKEEPER-2847: ---------------------------------------- looks like this patch breaks recent trunk build. There is at least one reconfig test failing deterministically. To reproduce: {code:java} ant test -Dtestcase=ReconfigLegacyTest -Dtest.method=testReconfigRemoveClientFromStatic test-core-java {code} This test was broken because it expected that if "clientPort" was available in static config file it should be kept there, for compatibility reasons (ZOOKEEPER-1992). The code checks if the condition is met using QuorumServer.clientAddr, which is null iff there is no clientPort in the static config file. The fix in this patch broke this assumption, because now QuorumServer.clientAddr will always be assigned a value, there is no way to differentiate if the value was assigned by reading from the server config portion of the static config file, or from the code (if (qs != null && qs.clientAddr == null) qs.clientAddr = clientPortAddress;). As a result, needEraseClientInfoFromStaticConfig now return true even if clientPort configuration is available in static config file, which leads to this test fails. I think we can use a dedicated field to represent the state of "should erase" for static config file to fix this. > Cannot bind to client port when reconfig based on old static config > ------------------------------------------------------------------- > > Key: ZOOKEEPER-2847 > URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2847 > Project: ZooKeeper > Issue Type: Bug > Components: server > Affects Versions: 3.5.3, 3.6.0 > Reporter: Fangmin Lv > Assignee: Yisong Yue > Priority: Major > Labels: pull-request-available > Fix For: 3.6.0 > > Time Spent: 1h 10m > Remaining Estimate: 0h > > When started the ensemble with old static config that the server string > doesn't have client port, dynamically remove and add the same server from the > ensemble will cause that server cannot bind to client port, and the ZooKeeper > server cannot serve client requests anymore. > From the code, we'll set the clientAddr to null when start up with old static > config, and dynamic config forces to have <client port> part, which will > trigger the following rebind code in QuorumPeer#processReconfig, and cause > the address already in used issue. > public boolean processReconfig(QuorumVerifier qv, Long suggestedLeaderId, > Long zxid, boolean restartLE) { > ... > if (myNewQS != null && myNewQS.clientAddr != null > && !myNewQS.clientAddr.equals(oldClientAddr)) { > cnxnFactory.reconfigure(myNewQS.clientAddr); > updateThreadName(); > } > ... > } -- This message was sent by Atlassian JIRA (v7.6.3#76005)