hiero-ledger / hiero-ledger/hiero-consensus-node
TransformingOutputWire.forward() skips remaining destinations and cleanup on null transform result
@abies is already working on this.
Since Sep 9, 2026.
- Dominant language
- Java
- Stars
- 407
- Forks
- 226
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 210
Description
Problem
In TransformingOutputWire.forward() (platform-sdk/consensus-wiring-framework/src/main/java/org/hiero/consensus/wiring/framework/wires/output/internal/TransformingOutputWire.java), when transform.apply(data) returns null for one destination, the method does return instead of skipping to the next destination. This has two effects:
- Remaining destinations in
forwardingDestinationsare never visited for this data item, even though a stateful transform may return non-null for them later — inconsistent fan-out. inputCleanup.accept(data)(which runs after the loop) is skipped entirely, leaking whatever resource the input holds (ref counts, off-heap buffers, etc.) on every null-transform occurrence.
Separately, the catch (Exception e) branch swallows failures from transform.apply/destination.accept but never invokes outputCleanup on a transformed value that was produced but never delivered — a related leak on the error path.
Proposed fix
- Replace the null-check
returnwithcontinue. - Wrap the loop so
inputCleanup.accept(data)runs exactly once per item on every exit path (success, null-transform, exception) — e.g. try/finally. - On exception in
destination.accept(transformed), invokeoutputCleanup.accept(transformed)for the undelivered value, consistent with the OFFER-reject path. - Unit tests: null transform on a non-last destination still reaches later destinations;
inputCleanupfires exactly once regardless of null/exception;outputCleanupfires when a destination throws after transform produced a value.
Reference: originally flagged as VLN-612 (hedera-security-issues#700) — confirmed not a security issue, but a real resource-leak / inconsistent-fan-out bug needing a fix and tests.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.