[Bug] OpenMessaging DefaultPromise.get returns before completion
- Dominant language
- Java
- Stars
- 22.6k
- Forks
- 12k
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 27
Description
## Runtime platform environment
macOS; reproduced with a deterministic unit test in the `openmessaging` module.
## RocketMQ version
Branch: `develop`
Git commit: `fd0c95920e0deac96ce2ae27442747cc5e65e930`
## JDK Version
Eclipse Temurin 17.0.19+10
## Describe the Bug
The no-argument `DefaultPromise.get()` returns the current `result` immediately. When the promise is still pending, callers receive `null` instead of waiting for completion. Reading a completed value also calls listeners again through `getValueOrThrowable`, which can duplicate callbacks.
## Steps to Reproduce
1. Create a new `DefaultPromise`.
2. Call `get()` from another thread before completing it.
3. Observe that the call returns `null` immediately.
4. Add a listener, complete the promise, then call `get()`; the listener can be invoked again.
## What Did You Expect to See?
`get()` should wait until completion, propagate failures, and listeners should be notified once when the state completes.
## What Did You See Instead?
`get()` returns before completion and completed value reads can notify listeners repeatedly.
## Additional Context
The timed `get(long)` API already provides the waiting mechanism that the no-argument method can reuse.
Contributor guide
Research direction
Start with DefaultPromise in the openmessaging module and inspect the existing timed get(long) implementation alongside the no-argument get(). Run the deterministic unit test described in the issue, then verify that pending calls wait for completion, failures propagate, and listeners are notified only once.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100