He-Pin opened a new pull request, #1154: URL: https://github.com/apache/pekko-http/pull/1154
### Motivation PR #1142 added cleanup for byte string transformers, but the stage marked itself finished as soon as finish returned. If the final ByteString was waiting for downstream demand and downstream cancelled, postStop observed the finished flag and skipped cleanup. The current Deflate and Gzip finish path already closes its Deflater before returning, so this follow-up hardens the generic stage lifecycle rather than claiming a second normal-path native leak. ### Modification Remove the finished flag and invoke the cleanup callback unconditionally from postStop, making cleanup the single finalizer for normal completion, failure, cancellation, and materializer shutdown. Add directional StreamUtils tests for normal completion and for cancellation while a final emission is pending. ### Result Transformer resources are finalized on every stage termination path. The only production cleanup callback is idempotent, so normal completion still calls Deflater.end exactly once. ### Tests - Regression test before the fix: StreamUtilsSpec failed 1 of 6 tests while waiting for cleanup after pending-final-emission cancellation - sbt "http-core / Test / testOnly org.apache.pekko.http.impl.util.StreamUtilsSpec": 7 passed - sbt "http-tests / Test / testOnly org.apache.pekko.http.scaladsl.coding.DeflateSpec org.apache.pekko.http.scaladsl.coding.GzipSpec": 54 passed, 3 pending - sbt checkCodeStyle: passed - sbt headerCreateAll: passed - sbt +headerCheckAll: passed - scalafmt --list --mode diff-ref=origin/main: passed - git diff --check: passed - Qoder CLI stdout review: No must-fix findings - sbt sortImports: failed locally with a Scalafix/scala.meta NoSuchMethodError after loading the old SortImports rule; unrelated generated edits were reverted - sbt validatePullRequest: not run locally per maintainer request; delegated to CI ### References Refs #1133 Refs #1142 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
