kaisun2000 opened a new issue #1294:
URL: https://github.com/apache/helix/issues/1294


   LOG:
   >2020-08-19T06:04:57.4143926Z [ERROR] 
testZkClientMonitor(org.apache.helix.zookeeper.impl.client.TestRawZkClient)  
Time elapsed: 0.036 s  <<< FAILURE!
   2020-08-19T06:04:57.4147601Z java.lang.AssertionError: expected:<0> but 
was:<1>
   2020-08-19T06:04:57.4154957Z         at 
org.apache.helix.zookeeper.impl.client.TestRawZkClient.testZkClientMonitor(TestRawZkClient.java:288)
   2020-08-19T06:04:57.4155636Z
   
   See the following code, there is a race condition here. connect() would 
cause a process() callback in zookeeper object eventThread.. If the _monitor is 
not constructed, the state changed value would be 0, otherwise, it would be 1.
   
   github is slow, the value is 1.
   ```
    protected ZkClient(IZkConnection zkConnection, int connectionTimeout, long 
operationRetryTimeout,
         PathBasedZkSerializer zkSerializer, String monitorType, String 
monitorKey,
         String monitorInstanceName, boolean monitorRootPathOnly) {
       if (zkConnection == null) {
         throw new NullPointerException("Zookeeper connection is null!");
       }
   
       _uid = UID.getAndIncrement();
   
       _connection = zkConnection;
       _pathBasedZkSerializer = zkSerializer;
       _operationRetryTimeoutInMillis = operationRetryTimeout;
       _isNewSessionEventFired = false;
   
       _asyncCallRetryThread = new 
ZkAsyncRetryThread(zkConnection.getServers());
       _asyncCallRetryThread.start();
       LOG.info("ZkClient created with _uid {}, _asyncCallRetryThread id {}, 
stack {}", _uid, _asyncCallRetryThread.getId(),
           Arrays.asList(Thread.currentThread().getStackTrace()));
   
       connect(connectionTimeout, this);
   
       // initiate monitor
       try {
         if (monitorKey != null && !monitorKey.isEmpty() && monitorType != null 
&& !monitorType
             .isEmpty()) {
           _monitor =
               new ZkClientMonitor(monitorType, monitorKey, 
monitorInstanceName, monitorRootPathOnly,
                   _eventThread);
           _monitor.register();
         } else {
           LOG.info("ZkClient monitor key or type is not provided. Skip 
monitoring.");
         }
       } catch (JMException e) {
         LOG.error("Error in creating ZkClientMonitor", e);
       }
     }
   ```
   


----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to