hiero-ledger / hiero-ledger/hiero-consensus-node
DefaultTransactionPrehandler busy-waits with no yield while waiting for latest immutable state
- Dominant language
- Java
- Stars
- 406
- Forks
- 226
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 210
Description
**Problem**
In `DefaultTransactionPrehandler.prehandleApplicationTransactions()` (`platform-sdk/consensus-transaction-handling/src/main/java/org/hiero/consensus/transaction/handling/internal/DefaultTransactionPrehandler.java`), the code busy-waits for the latest immutable state with no yield, sleep, backoff, or timeout:
```java
while (latestImmutableState == null) {
latestImmutableState = signedStateNexus.getState(RESERVATION_LABEL);
}
```
`signedStateNexus.getState()` is documented as possibly returning `null` (implementation detail of the locking mechanism within the supplier). If it returns null for an extended period every pre-handle worker thread burns 100% CPU in a tight spin with no log message or metric, stalling the pre-handle pipeline.
**Trigger is internal** (supplier returning null due to locking/timing), not attacker-controlled input
**Proposed fix**
- Add `Thread.yield()` inside the spin loop to release the CPU between polls
**Reference:** originally flagged as VLN-620 (hedera-security-issues#708) — confirmed not a security issue, but a real liveness/CPU-burn bug. Fix scope intentionally kept minimal (yield only) rather than the full bounded-retry/timeout/metric remediation from the original finding.
Contributor guide
Assessment
This issue has not been assessed yet.