hiero-ledger / hiero-ledger/hiero-consensus-node

TransformingOutputWire.forward() skips remaining destinations and cleanup on null transform result

Open
#27,084 0 comments 0 reactions 1 assignee View on GitHub

@abies is already working on this.

Since Sep 9, 2026.

Bug
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:

  1. Remaining destinations in forwardingDestinations are never visited for this data item, even though a stateful transform may return non-null for them later — inconsistent fan-out.
  2. 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 return with continue.
  • 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), invoke outputCleanup.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; inputCleanup fires exactly once regardless of null/exception; outputCleanup fires 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.