drpmma commented on issue #5710:
URL: https://github.com/apache/rocketmq/issues/5710#issuecomment-1354084653

   > the `waitForRunning`'s behavior in the ServiceThread is indefinite in some 
worst cases.
   
   There is indeed a concurrent issue on `waitPoint`, but it will not lead to 
indefinite waiting.
   
   ```java
   protected void waitForRunning(long interval) { 
        if (hasNotified.compareAndSet(true, false)) { 
            this.onWaitEnd(); 
            return; 
        } 
     
        // 1. execute wakeup() here will cause a extra waiting
   
        waitPoint.reset(); 
     
       // 2. execute wakeup() here will lead to immediate wakeup without waiting
   
        try { 
            waitPoint.await(interval, TimeUnit.MILLISECONDS); 
        } catch (InterruptedException e) { 
            log.error("Interrupted", e); 
   ```
   
   As the annotation below, the `wakeup()` invocation before 
`waitPoint.reset()` will cause a extra waiting while `wakeup()` execution after 
`waitPoint.reset()` will lead to immediate wakeup without waiting.
   
   There is indeed a concurrent issue and do you have the indentation to submit 
to pr to fix it?
   
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to