You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that if waitAndDrain is called twice in a multi-threaded scenario, there will be no wait on the second execution because if the cas fails, it will return. Here is my test code:
@test
void testV2() throws InterruptedException {
new Thread(()->{
try {
executor.waitAndDrain(Long.MAX_VALUE);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}).start();
executor.waitAndDrain(Long.MAX_VALUE);
System.out.println("wait not worked");
}
There is no example in Dubbo where waitAndDrain is executed through the same threadlessExecutor across multiple threads, so there shouldn't be any issues. I don't know if this is a bug.
Related issues
No response
Are you willing to submit a pull request to fix on your own?
Yes I am willing to submit a pull request on my own!
Pre-check
Search before asking
Apache Dubbo Component
Java SDK (apache/dubbo)
Descriptions
This is the source code of the ThreadlessExecutor waitAndDrain method:
dubbo/dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/ThreadlessExecutor.java
Lines 52 to 80 in ca7151e
It seems that if waitAndDrain is called twice in a multi-threaded scenario, there will be no wait on the second execution because if the cas fails, it will return. Here is my test code:
There is no example in Dubbo where waitAndDrain is executed through the same threadlessExecutor across multiple threads, so there shouldn't be any issues. I don't know if this is a bug.
Related issues
No response
Are you willing to submit a pull request to fix on your own?
Code of Conduct
The text was updated successfully, but these errors were encountered: