You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "dkranchii (via GitHub)" <gi...@apache.org> on 2026/04/27 02:42:45 UTC
[PR] [SPARK-55553][GRAPHX] Unpersist sccWorkGraph in StronglyConnectedComponents [spark]
dkranchii opened a new pull request, #55554:
URL: https://github.com/apache/spark/pull/55554
### What changes were proposed in this pull request?
`StronglyConnectedComponents.run` mirrors the existing `prevSccGraph` unpersist lifecycle for `sccWorkGraph`. Each of the two `sccWorkGraph` reassignments inside the inner `do/while` loop (the `outerJoinVertices` step and the `subgraph` step) now materializes the new generation via `vertices.count()` / `edges.count()` and then unpersists the previous generation, using the same idiom already in place for `sccGraph`.
Tracking issue: https://github.com/apache/spark/issues/55553
### Why are the changes needed?
The two `sccWorkGraph = ... .cache()` reassignments in the inner loop each leak a cached `Graph` generation per iteration. SPARK-16478 (2016) added the equivalent unpersist lifecycle for `sccGraph` but did not extend it to `sccWorkGraph`, leaving an asymmetric cache leak in the public SCC implementation:
```
grep -n unpersist graphx/src/main/scala/org/apache/spark/graphx/lib/StronglyConnectedComponents.scala
# Only references prevSccGraph; no sccWorkGraph.unpersist() exists prior to this PR.
```
On graphs that take many inner iterations to converge (large SCCs, high diameter), the accumulated cached state evicts useful blocks under `MEMORY_AND_DISK`, triggers recomputation cascades through the join lineage, and ultimately produces executor memory pressure that presents as "SCC slows down progressively" or OOMs on long runs. `ContextCleaner` eventually unpersists orphaned RDDs once Scala references are GC'd, but the timing is non-deterministic and lags the loop body — exactly the failure mode the existing `prevSccGraph.unpersist()` was added to prevent.
### Does this PR introduce _any_ user-facing change?
No. Algorithm and output of `Graph.stronglyConnectedComponents` are unchanged. Only cache lifecycle is adjusted, mirroring the pattern already used for `sccGraph` in the same function.
### How was this patch tested?
- Existing `StronglyConnectedComponentsSuite` continues to pass.
- Manual verification on a synthetic graph requiring multiple inner iterations to converge: the Spark UI **Storage** tab confirms that the count of cached `Graph` RDDs remains bounded across iterations after the fix, whereas it grew monotonically before.
- No new tests added — the change preserves observable behavior; correctness is covered by the existing suite, and the leak is resource-level (cached block count) rather than functional.
### Related references
- GitHub issue: https://github.com/apache/spark/issues/55553 (this PR)
- [SPARK-26771](https://issues.apache.org/jira/browse/SPARK-26771) — made `unpersist()` non-blocking by default; this PR uses the no-arg `unpersist()` form, consistent with that change.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [GRAPHX] Unpersist sccWorkGraph in StronglyConnectedComponents [spark]
Posted by "dkranchii (via GitHub)" <gi...@apache.org>.
dkranchii commented on PR #55554:
URL: https://github.com/apache/spark/pull/55554#issuecomment-4365486355
@viirya can you review this.
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55553][GRAPHX] Unpersist sccWorkGraph in StronglyConnectedComponents [spark]
Posted by "dkranchii (via GitHub)" <gi...@apache.org>.
dkranchii commented on PR #55554:
URL: https://github.com/apache/spark/pull/55554#issuecomment-4437548474
Thanks @dongjoon-hyun . I've updated the PR description to follow the template (including the AI tooling disclosure).
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [GRAPHX] Unpersist sccWorkGraph in StronglyConnectedComponents [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #55554:
URL: https://github.com/apache/spark/pull/55554#issuecomment-4391232153
Please follow the community guideline like other PRs.
For the detail, you can see the following resources, @dkranchii .
- https://github.com/apache/spark/blob/master/AGENTS.md
- https://spark.apache.org/contributing.html
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55553][GRAPHX] Unpersist sccWorkGraph in StronglyConnectedComponents [spark]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #55554:
URL: https://github.com/apache/spark/pull/55554#issuecomment-5376711213
We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
If you'd like to revive this PR, please reopen it and ask a committer to remove the Stale tag!
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [GRAPHX] Unpersist sccWorkGraph in StronglyConnectedComponents [spark]
Posted by "dkranchii (via GitHub)" <gi...@apache.org>.
dkranchii commented on PR #55554:
URL: https://github.com/apache/spark/pull/55554#issuecomment-4391182373
@dongjoon-hyun can you please review this pr. thanks
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55553][GRAPHX] Unpersist sccWorkGraph in StronglyConnectedComponents [spark]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #55554: [SPARK-55553][GRAPHX] Unpersist sccWorkGraph in StronglyConnectedComponents
URL: https://github.com/apache/spark/pull/55554
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org