You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@helix.apache.org by GitBox <gi...@apache.org> on 2020/08/19 22:52:04 UTC

[GitHub] [helix] kaisun2000 opened a new issue #1294: Fix flaky test TestRawZkClient.testZkClientMonitor()

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org


[GitHub] [helix] jiajunwang closed issue #1294: Fix flaky test TestRawZkClient.testZkClientMonitor()

Posted by GitBox <gi...@apache.org>.
jiajunwang closed issue #1294:
URL: https://github.com/apache/helix/issues/1294


   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@helix.apache.org
For additional commands, e-mail: reviews-help@helix.apache.org