Skip to content

prevent memory leak from uncleaned futures - #402

Open
bbortt wants to merge 1 commit into
citrusframework:mainfrom
postfinance:fix/memory-leak
Open

prevent memory leak from uncleaned futures#402
bbortt wants to merge 1 commit into
citrusframework:mainfrom
postfinance:fix/memory-leak

Conversation

@bbortt

@bbortt bbortt commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Timed-out and failed requests left CompletableFuture, HttpMessage,
and LinkedBlockingQueue$Node instances permanently in ScenarioEndpoint's internal collections, causing unbounded heap growth.

  • Add ScenarioEndpoint.cancel() to remove a future from all internal collections (orderedFutures, pendingFutures, channel, activeFutures)
  • Call cancel() in SimulatorEndpointAdapter on TimeoutException, InterruptedException, ExecutionException, and synchronous run() failure
  • Fix fail() to clean up activeFutures after receive() was already called, closing the "received-then-failed" leak path

@bbortt bbortt self-assigned this Jul 27, 2026
…failure

Timed-out and failed requests left `CompletableFuture`,
`HttpMessage`,
and `LinkedBlockingQueue$Node` instances permanently in `ScenarioEndpoint`'s internal collections,
causing unbounded heap growth.

- Add `ScenarioEndpoint.cancel()` to remove a future from all internal collections (`orderedFutures`, `pendingFutures`, `channel`, `activeFutures`)
- Call `cancel()` in `SimulatorEndpointAdapter` on `TimeoutException`,
  `InterruptedException`, `ExecutionException`, and synchronous `run()` failure
- Fix `fail()` to clean up activeFutures after `receive()` was already called, closing the "received-then-failed" leak path
@bbortt
bbortt force-pushed the fix/memory-leak branch from 103b1e3 to 69692b0 Compare July 27, 2026 10:03
@bbortt
bbortt requested a review from christophd July 27, 2026 10:03
@bbortt

bbortt commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator Author

unrelated to #392. if possible:

  1. merge first
  2. create release
  3. merge update to citrusframework 5 & spring boot 4 #392
  4. create (major) release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant