The GitHub Actions job "Pull Requests" on 
pekko.git/fix/unfold-resource-async-close-after-read has succeeded.
Run started by GitHub user He-Pin (triggered by He-Pin).

Head commit for run:
6255bc92ceca266ebca491b04a0d436900f6ccf0 / 虎鸣 <[email protected]>
fix: delay unfoldResourceAsync close until pending read completes

Motivation:
Source.unfoldResourceAsync could call close(resource) from postStop while a 
readData(resource) Future was still running, allowing close and read to operate 
on the same resource concurrently.

Modification:
Track the current read Future with a null-sentinel field and, on postStop, 
defer close(resource) until that Future completes. Clear the field on 
synchronous and asynchronous read completion to keep the hot path simple and 
avoid retaining completed reads. Add a regression test that cancels while a 
read is pending and asserts close is not called until the read completes.

Result:
Cancellation no longer closes the resource concurrently with an in-flight 
readData call, while existing unfoldResourceAsync completion, restart, resume, 
and close behavior remains covered.

Tests:
- scalafmt --mode diff-ref=origin/main: passed (JDK 25 Unsafe deprecation 
warning only)
- scalafmt --list --mode diff-ref=origin/main: passed (JDK 25 Unsafe 
deprecation warning only)
- sbt "stream-tests / Test / testOnly 
org.apache.pekko.stream.scaladsl.UnfoldResourceAsyncSourceSpec -- -z \"wait for 
pending read before closing resource when stream is cancelled\"": passed
- same focused test against old postStop behavior: failed as expected with 
close observing readCompleted=false
- sbt "stream-tests / Test / testOnly 
org.apache.pekko.stream.scaladsl.UnfoldResourceAsyncSourceSpec": passed, 21 
tests
- sbt checkCodeStyle: passed
- sbt +headerCheckAll: passed
- git diff --check: passed
- sbt validatePullRequest: Not run - focused stream test, style, and header 
validation run locally

References:
Fixes #3134

Report URL: https://github.com/apache/pekko/actions/runs/28044016321

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to