RockteMQ-AI commented on issue #10860:
URL: https://github.com/apache/rocketmq/issues/10860#issuecomment-5225835847
**Issue Evaluation**
Category: `bug` | Status: **Confirmed**
The reported issue has been verified against the current codebase (commit
`fd0c959`).
**Root Cause:** `DefaultPromise.get()` (line 62) simply returns
`this.result` without any waiting logic. If the promise has not been completed
yet, `result` is `null`, and the method returns `null` immediately instead of
blocking until the result is available.
In contrast, `get(long timeout)` (line 66) correctly implements wait
semantics with `lock.wait()`.
**Impact:** Any code calling the no-arg `get()` on an incomplete promise
receives `null` instead of the actual result, leading to silent data loss or
NullPointerException downstream. This violates the OpenMessaging `Promise`
contract where `get()` should block until completion.
**Severity:** high — core API contract violation in the OpenMessaging
integration layer
**Suggested Fix:** Delegate to `get(Long.MAX_VALUE)` or implement proper
blocking:
```java
@Override
public V get() {
synchronized (lock) {
if (!isDoing()) {
return getValueOrThrowable();
}
try {
lock.wait();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
cancel(e);
}
return getValueOrThrowable();
}
}
```
An automated fix proposal will be generated. Reply `/approve` to proceed
with PR generation.
---
*Automated evaluation by RockteMQ-AI*
--
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]