Skip to content

Commit d29add0

Browse files
committed
fix: release references to completed stage logics in GraphInterpreter
Motivation: GraphInterpreter retains strong references to completed stage logics in the logics array, preventing garbage collection even after stages have finished. This is especially problematic for long-running fused interpreters that host subfused shells, where completed initial stages remain referenced for the lifetime of the actor. Additionally, Connection objects retain strong references to handler objects (inHandler/outHandler), further preventing GC of completed stage logics. Modification: - afterStageHasRun now scans ALL logics for completed stages instead of only checking the single activeStage. This ensures stages that complete without being activeStage (e.g., boundary stages calling complete(), cascading completions) are properly finalized and released. - finish() and afterStageHasRun null connection handlers (inHandler/ outHandler) for finalized stages, breaking handler-to-logic reference chains to enable garbage collection. - toSnapshot handles null logics gracefully with <completed> placeholder and uses connection.inOwner.stageId for positional indexing instead of identity-based map lookups that fail with NPE on null logics. - inLogicName/outLogicName debug methods guard against null logics. - finish() sets logics(i) = null after finalizing each stage. - Fix GraphStageLogicSpec "not double-terminate" test to save logic references before execute() since afterStageHasRun now releases completed logics. Result: Completed stage logics are properly finalized and released for GC during normal stream execution (not just in finish()), reducing memory retention in long-running fused interpreters. Tests: - stream-tests/testOnly GraphInterpreterSpec: 13/13 passed (includes 2 new regression tests) - stream-tests/testOnly GraphStageLogicSpec: 17/17 passed - stream-tests/testOnly InterpreterSpec+LifecycleInterpreterSpec+InterpreterSupervisionSpec+GraphInterpreterFailureModesSpec: 54/54 passed References: None - memory leak fix
1 parent 8a09821 commit d29add0

679 files changed

Lines changed: 5016 additions & 7395 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/binary-compatibility-checks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
3838
steps:
3939
- name: Checkout
40-
uses: actions/checkout@v6.0.3
40+
uses: actions/checkout@v6.0.2
4141
with:
4242
fetch-depth: 0
4343
fetch-tags: 0
@@ -50,7 +50,7 @@ jobs:
5050
java-version: 17
5151

5252
- name: Install sbt
53-
uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1
53+
uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24
5454

5555
- name: Cache Coursier cache
5656
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1

.github/workflows/build-test-prValidation.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
2727
steps:
2828
- name: Checkout
29-
uses: actions/checkout@v6.0.3
29+
uses: actions/checkout@v6.0.2
3030
with:
3131
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
3232
fetch-depth: 0
@@ -43,15 +43,15 @@ jobs:
4343
java-version: 17
4444

4545
- name: Install sbt
46-
uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1
46+
uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24
4747

4848
- name: Code style check
4949
run: |-
5050
cp .jvmopts-ci .jvmopts
5151
sbt \
5252
-Dsbt.override.build.repos=false \
5353
-Dsbt.log.noformat=false \
54-
checkCodeStyle
54+
javafmtCheckAll
5555
pull-request-validation:
5656
name: Check / Tests
5757
runs-on: ubuntu-22.04
@@ -62,7 +62,7 @@ jobs:
6262
scalaVersion: ["2.13.x", "3.3.x"]
6363
steps:
6464
- name: Checkout
65-
uses: actions/checkout@v6.0.3
65+
uses: actions/checkout@v6.0.2
6666
with:
6767
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
6868
fetch-depth: 0
@@ -76,7 +76,7 @@ jobs:
7676
java-version: 17
7777

7878
- name: Install sbt
79-
uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1
79+
uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24
8080

8181
- name: Cache Coursier cache
8282
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1
@@ -126,7 +126,7 @@ jobs:
126126
- cluster/test distributed-data/test cluster-tools/test cluster-metrics/test
127127
steps:
128128
- name: Checkout
129-
uses: actions/checkout@v6.0.3
129+
uses: actions/checkout@v6.0.2
130130
with:
131131
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
132132
fetch-depth: 0
@@ -140,7 +140,7 @@ jobs:
140140
java-version: 17
141141

142142
- name: Install sbt
143-
uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1
143+
uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24
144144

145145
- name: Cache Coursier cache
146146
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1
@@ -164,13 +164,13 @@ jobs:
164164
clean ${{ matrix.command }}
165165
166166
jdk-21-extra-tests:
167-
name: Java 21 Extra Tests
167+
name: Java 21 Extra Tests (including all tests that need Java 9+)
168168
runs-on: ubuntu-22.04
169169
env:
170170
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
171171
steps:
172172
- name: Checkout
173-
uses: actions/checkout@v6.0.3
173+
uses: actions/checkout@v6.0.2
174174
with:
175175
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
176176
fetch-depth: 0
@@ -184,15 +184,15 @@ jobs:
184184
java-version: 21
185185

186186
- name: Install sbt
187-
uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1
187+
uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24
188188

189189
- name: Cache Coursier cache
190190
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1
191191

192192
- name: Enable jvm-opts
193193
run: cp .jvmopts-ci .jvmopts
194194

195-
- name: sbt TestJdk21/test
195+
- name: sbt TestJdk9/test
196196
run: |-
197197
sbt \
198198
-Dpekko.mima.enabled=false \
@@ -206,4 +206,4 @@ jobs:
206206
-Dsbt.log.noformat=false \
207207
-Dpekko.log.timestamps=true \
208208
-Dio.netty.leakDetection.level=PARANOID \
209-
TestJdk21/test
209+
TestJdk9/test

.github/workflows/dependency-graph.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ jobs:
3333
# to submit dependencies
3434
contents: write
3535
steps:
36-
- uses: actions/checkout@v6.0.3
36+
- uses: actions/checkout@v6.0.2
3737
with:
3838
persist-credentials: false
3939
- name: Install sbt
40-
uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1
41-
- uses: scalacenter/sbt-dependency-submission@d84eef4c09e633bcf5f113bcad7fd5e9af1baee9 # v3.1.1
40+
uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24
41+
- uses: scalacenter/sbt-dependency-submission@1cc96a7038ea2b014c200c1dae3a0cc92293b91d # v3.1.1
4242
with:
43-
configs-ignore: provided optional test TestJdk21 compile-internal runtime-internal pr-validation multi-jvm scala-tool scala-doc-tool
43+
configs-ignore: provided optional test TestJdk9 compile-internal runtime-internal pr-validation multi-jvm scala-tool scala-doc-tool
4444
modules-ignore: pekko-bench-jmh_2.13 pekko-docs_2.13 pekko-bench-jmh_3 pekko-docs_3

.github/workflows/format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
runs-on: ubuntu-latest
3030
steps:
3131
- name: Checkout current branch (full)
32-
uses: actions/checkout@v6.0.3
32+
uses: actions/checkout@v6.0.2
3333
with:
3434
fetch-depth: 0
3535
persist-credentials: false

.github/workflows/generate-doc-check.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
if: github.repository == 'apache/pekko'
3131
steps:
3232
- name: Checkout
33-
uses: actions/checkout@v6.0.3
33+
uses: actions/checkout@v6.0.2
3434
with:
3535
fetch-depth: 0
3636
fetch-tags: true
@@ -43,7 +43,7 @@ jobs:
4343
java-version: 17
4444

4545
- name: Install sbt
46-
uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1
46+
uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24
4747

4848
- name: Cache Coursier cache
4949
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1
@@ -55,4 +55,4 @@ jobs:
5555
- name: Compile testClass&docs for all Scala versions
5656
env:
5757
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
58-
run: sbt ";+TestJdk21 / compile ; +compile:doc"
58+
run: sbt ";+TestJdk9 / compile ; +compile:doc"

.github/workflows/headers.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
runs-on: ubuntu-22.04
2929
steps:
3030
- name: Checkout
31-
uses: actions/checkout@v6.0.3
31+
uses: actions/checkout@v6.0.2
3232
with:
3333
persist-credentials: false
3434

@@ -39,7 +39,7 @@ jobs:
3939
java-version: 17
4040

4141
- name: Install sbt
42-
uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1
42+
uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24
4343

4444
- name: Cache Coursier cache
4545
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1

.github/workflows/link-validator.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
if: github.repository == 'apache/pekko'
2222
steps:
2323
- name: Checkout
24-
uses: actions/checkout@v6.0.3
24+
uses: actions/checkout@v6.0.2
2525
with:
2626
persist-credentials: false
2727

@@ -38,7 +38,7 @@ jobs:
3838
java-version: 17
3939

4040
- name: Install sbt
41-
uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1
41+
uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24
4242

4343
- name: Cache Coursier cache
4444
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1

.github/workflows/nightly-1.0-builds.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
if: github.repository == 'apache/pekko'
2222
steps:
2323
- name: Checkout
24-
uses: actions/checkout@v6.0.3
24+
uses: actions/checkout@v6.0.2
2525
with:
2626
fetch-depth: 0
2727
fetch-tags: true
@@ -35,7 +35,7 @@ jobs:
3535
java-version: 11
3636

3737
- name: Install sbt
38-
uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1
38+
uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24
3939

4040
- name: Cache Coursier cache
4141
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1
@@ -75,7 +75,7 @@ jobs:
7575
- cluster-typed/test cluster-sharding-typed/test
7676
steps:
7777
- name: Checkout
78-
uses: actions/checkout@v6.0.3
78+
uses: actions/checkout@v6.0.2
7979
with:
8080
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
8181
fetch-depth: 0
@@ -90,7 +90,7 @@ jobs:
9090
java-version: 11
9191

9292
- name: Install sbt
93-
uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1
93+
uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24
9494

9595
- name: Cache Coursier cache
9696
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1
@@ -127,7 +127,7 @@ jobs:
127127
javaVersion: [8, 11, 17, 21]
128128
steps:
129129
- name: Checkout
130-
uses: actions/checkout@v6.0.3
130+
uses: actions/checkout@v6.0.2
131131
with:
132132
fetch-depth: 0
133133
fetch-tags: true
@@ -141,7 +141,7 @@ jobs:
141141
java-version: ${{ matrix.javaVersion }}
142142

143143
- name: Install sbt
144-
uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1
144+
uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24
145145

146146
- name: Cache Coursier cache
147147
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1

.github/workflows/nightly-1.1-builds.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
if: github.repository == 'apache/pekko'
2222
steps:
2323
- name: Checkout
24-
uses: actions/checkout@v6.0.3
24+
uses: actions/checkout@v6.0.2
2525
with:
2626
fetch-depth: 0
2727
fetch-tags: true
@@ -35,7 +35,7 @@ jobs:
3535
java-version: 11
3636

3737
- name: Install sbt
38-
uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1
38+
uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24
3939

4040
- name: Cache Coursier cache
4141
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1
@@ -76,7 +76,7 @@ jobs:
7676
- cluster-typed/test cluster-sharding-typed/test
7777
steps:
7878
- name: Checkout
79-
uses: actions/checkout@v6.0.3
79+
uses: actions/checkout@v6.0.2
8080
with:
8181
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
8282
fetch-depth: 0
@@ -91,7 +91,7 @@ jobs:
9191
java-version: 11
9292

9393
- name: Install sbt
94-
uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1
94+
uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24
9595

9696
- name: Cache Coursier cache
9797
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1
@@ -129,7 +129,7 @@ jobs:
129129
javaVersion: [8, 11, 17, 21]
130130
steps:
131131
- name: Checkout
132-
uses: actions/checkout@v6.0.3
132+
uses: actions/checkout@v6.0.2
133133
with:
134134
fetch-depth: 0
135135
fetch-tags: true
@@ -143,7 +143,7 @@ jobs:
143143
java-version: ${{ matrix.javaVersion }}
144144

145145
- name: Install sbt
146-
uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1
146+
uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24
147147

148148
- name: Cache Coursier cache
149149
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1

.github/workflows/nightly-1.2-builds.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
if: github.repository == 'apache/pekko'
2222
steps:
2323
- name: Checkout
24-
uses: actions/checkout@v6.0.3
24+
uses: actions/checkout@v6.0.2
2525
with:
2626
fetch-depth: 0
2727
fetch-tags: true
@@ -35,7 +35,7 @@ jobs:
3535
java-version: 11
3636

3737
- name: Install sbt
38-
uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1
38+
uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24
3939

4040
- name: Cache Coursier cache
4141
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1
@@ -76,7 +76,7 @@ jobs:
7676
- cluster-typed/test cluster-sharding-typed/test
7777
steps:
7878
- name: Checkout
79-
uses: actions/checkout@v6.0.3
79+
uses: actions/checkout@v6.0.2
8080
with:
8181
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
8282
fetch-depth: 0
@@ -91,7 +91,7 @@ jobs:
9191
java-version: 11
9292

9393
- name: Install sbt
94-
uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1
94+
uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24
9595

9696
- name: Cache Coursier cache
9797
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1
@@ -129,7 +129,7 @@ jobs:
129129
javaVersion: [8, 11, 17, 21]
130130
steps:
131131
- name: Checkout
132-
uses: actions/checkout@v6.0.3
132+
uses: actions/checkout@v6.0.2
133133
with:
134134
fetch-depth: 0
135135
fetch-tags: true
@@ -143,7 +143,7 @@ jobs:
143143
java-version: ${{ matrix.javaVersion }}
144144

145145
- name: Install sbt
146-
uses: sbt/setup-sbt@af116cce31c00823d3903ce687f9cda3a4f19f1b # v1.2.1
146+
uses: sbt/setup-sbt@2e222825582620cc38d2a54e674f3c01b7c14f5d # v1.1.24
147147

148148
- name: Cache Coursier cache
149149
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # 8.1.1

0 commit comments

Comments
 (0)