[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-1858?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13868691#comment-13868691
 ] 

Germán Blanco commented on ZOOKEEPER-1858:
------------------------------------------

I think I understand now. I will put it in my own words.
The problem that you solve here is that there are test cases in which we have 
running zk clients while a server is stopped and started with 
ClientBase.stopServer and ClientBase.startServer. ClientBase.startServer has an 
assertion checking that there are no session beans in JMX, however, depending 
on timing, the running zk clients might be able to reconnect and create session 
beans before the check takes place. So we need to have those beans into account 
in the checking in order to avoid problems.
ZOOKEEPER-1837 does not solve the problem, since ZOOKEEPER-1837 just repeats 
this check a few times in order to avoid race conditions in which the JMX 
update may take longer, but this is actually happening because the correct 
status in JMX takes less time (with respect to the threads that checks) than 
what it seems to take in other environments.

Please correct this interpretation if wrong. Otherwise, +1, it looks good to me.

> JMX checks - potential race conditions while stopping and starting server
> -------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-1858
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1858
>             Project: ZooKeeper
>          Issue Type: Sub-task
>            Reporter: Rakesh R
>            Assignee: Rakesh R
>              Labels: test
>             Fix For: 3.4.6, 3.5.0
>
>         Attachments: ZOOKEEPER-1858-br3.4.patch, ZOOKEEPER-1858.patch
>
>
> I've noticed one potential case, where previously created zkclient session 
> immediately reconnected and publishing those beans while starting back the 
> zkserver and affecting zk#startup jmx checks.
> Say, before stopping the server, there is a zk client session 
> 0x143576544c50000 exists. While starting back the server, there could be 
> possibility of seeing the client sessions in jmx. Following is one such case. 
> Please see below logs which has taken from build 
> https://builds.apache.org/job/ZooKeeper-trunk-WinVS2008_java/642/
> {code}    [junit] 2014-01-03 09:18:12,809 [myid:] - INFO  
> [main-SendThread(127.0.0.1:11222):ClientCnxn$SendThread@1228] - Session 
> establishment complete on server 127.0.0.1/127.0.0.1:11222, sessionid = 
> 0x143576544c50000, negotiated timeout = 30000
>     [junit] 2014-01-03 09:18:12,809 [myid:] - INFO  
> [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:11222:ZooKeeperServer@617] - 
> Established session 0x143576544c50000 with negotiated timeout 30000 for 
> client /127.0.0.1:55377{code}
> {code} [junit] 2014-01-03 09:18:12,391 [myid:] - INFO  [main:JMXEnv@135] - 
> ensureOnly:[]
>     [junit] 2014-01-03 09:18:12,395 [myid:] - INFO  [main:ClientBase@438] - 
> STARTING server
>     [junit] 2014-01-03 09:18:12,395 [myid:] - INFO  [main:ClientBase@359] - 
> CREATING server instance 127.0.0.1:11222
>     [junit] 2014-01-03 09:18:12,395 [myid:] - INFO  
> [main:NIOServerCnxnFactory@94] - binding to port 0.0.0.0/0.0.0.0:11222
>     [junit] 2014-01-03 09:18:12,395 [myid:] - INFO  [main:ClientBase@334] - 
> STARTING server instance 127.0.0.1:11222
>     [junit] 2014-01-03 09:18:19,030 [myid:] - INFO  [main:JMXEnv@142] - 
> unexpected:org.apache.ZooKeeperService:name0=StandaloneServer_port-1,name1=Connections,name2=127.0.0.1,name3=0x143576544c50000
>     [junit] 2014-01-03 09:18:19,030 [myid:] - INFO  [main:JMXEnv@142] - 
> unexpected:org.apache.ZooKeeperService:name0=StandaloneServer_port-1
>     [junit] 2014-01-03 09:18:19,030 [myid:] - INFO  
> [main:JUnit4ZKTestRunner$LoggedInvokeMethod@62] - TEST METHOD FAILED 
> testDefaultWatcherAutoResetWithChroot
>     [junit] junit.framework.AssertionFailedError: expected:<0> but was:<2>
>     [junit]   at junit.framework.Assert.fail(Assert.java:47)
>     [junit]   at junit.framework.Assert.failNotEquals(Assert.java:283)
>     [junit]   at junit.framework.Assert.assertEquals(Assert.java:64)
>     [junit]   at junit.framework.Assert.assertEquals(Assert.java:195)
>     [junit]   at junit.framework.Assert.assertEquals(Assert.java:201)
>     [junit]   at org.apache.zookeeper.test.JMXEnv.ensureOnly(JMXEnv.java:144)
>     [junit]   at 
> org.apache.zookeeper.test.ClientBase.startServer(ClientBase.java:443)
>     [junit]   at 
> org.apache.zookeeper.test.DisconnectedWatcherTest.testDefaultWatcherAutoResetWithChroot(DisconnectedWatcherTest.java:123)
>     [junit]   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> {code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to