Skip to content

[Problem] Fix FlowableCache GC issue - #8247

Closed
DragonFSKY wants to merge 1 commit into
ReactiveX:3.xfrom
DragonFSKY:issue-7912-flowable-cache-gc
Closed

[Problem] Fix FlowableCache GC issue#8247
DragonFSKY wants to merge 1 commit into
ReactiveX:3.xfrom
DragonFSKY:issue-7912-flowable-cache-gc

Conversation

@DragonFSKY

Copy link
Copy Markdown
Contributor

Summary

  • Move the source-facing cache state and subscriber registry into a static Multicaster, so the upstream connection and active CacheSubscriptions no longer retain the outer FlowableCache.
  • Keep per-subscriber request accounting, cancellation, and serialized replay behavior unchanged.
  • Retain the cache head only from FlowableCache, retain the current tail from Multicaster, and clear the tail on termination.
  • Ignore post-terminal source signals now that termination clears the tail.
  • Add a focused MemoryMXBean / System.gc() regression test matching the approach used for ObservableCache in Fix ObservableCache GC issue #7911.

Tests

  • ./gradlew build --stacktrace
  • ./gradlew javadoc --stacktrace
  • FlowableCacheTest.valuesAreReclaimable repeated five times
  • The regression test fails against the unmodified implementation because the cached payload remains retained.

References

Checklist

  • The description explains what changed and why.
  • The related issue and reference PR are included.
  • A focused regression test is included; existing FlowableCacheTest coverage continues to exercise empty, range, error, backpressure, cancellation, and race behavior.

Split the source-facing subscriber state from FlowableCache so the upstream connection no longer retains the cache head. Preserve per-subscriber backpressure and replay semantics, clear the tail on termination, and add a focused heap-reclamation regression test.
@github-actions

Copy link
Copy Markdown

🐷 TruffleHog + Entropy Beauty Scan

Average entropy of changed code: 4.647 bits/char
Verdict: ✅ Mid-4 beauty detected (thoughtful human code!)

Changed files entropy:

.gitattributes: 4.493
.github/ISSUE_TEMPLATE.md: 4.674
.github/PULL_REQUEST_TEMPLATE.md: 4.463
.github/dependabot.yml: 4.262
.github/workflows/compute-entropy.py: 4.850
.github/workflows/entropy-beauty-scan.yml: 4.583
.github/workflows/gradle-wrapper-validation.yml: 4.987
.github/workflows/gradle_branch.yml: 5.075
.github/workflows/gradle_jdk11.yml: 5.008
.github/workflows/gradle_pr.yml: 4.977
.github/workflows/gradle_release.yml: 5.190
.github/workflows/gradle_snapshot.yml: 5.018
.github/workflows/scorecard.yml: 4.752
.gitignore: 4.635
.gitpod.yml: 4.605
CONTRIBUTING.md: 4.704
COPYRIGHT: 4.927
DESIGN.md: 4.801
LICENSE: 4.427
README.md: 4.989

✅ No secrets or suspicious high-entropy strings found.

Mid-4 beauty heuristic in action — powered by our entropy chats! 😊

@akarnokd

Copy link
Copy Markdown
Member

Looks okay, but how much do you need this in 3.x?

I'd prefer you primarily target 4.x first and then backport if someone does have a need for in 3.x.

I don't want to release more 3.x versions that aren't bug or crash fixes. This issue is more like GC pedantics than a grave mistake.

@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.61%. Comparing base (9b55d01) to head (b0c3676).
⚠️ Report is 234 commits behind head on 3.x.

Additional details and impacted files
@@             Coverage Diff              @@
##                3.x    #8247      +/-   ##
============================================
- Coverage     99.62%   99.61%   -0.01%     
+ Complexity     6801     6744      -57     
============================================
  Files           752      752              
  Lines         47707    47727      +20     
  Branches       6401     6404       +3     
============================================
+ Hits          47527    47544      +17     
+ Misses           84       80       -4     
- Partials         96      103       +7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@akarnokd akarnokd added this to the 3.1-support milestone Jul 27, 2026
@akarnokd
akarnokd marked this pull request as draft July 27, 2026 15:33
@akarnokd akarnokd changed the title Fix FlowableCache GC issue [Problem] Fix FlowableCache GC issue Jul 27, 2026
@akarnokd

Copy link
Copy Markdown
Member

Also if you used AI, you have to disclose it, even for mechanistical changes.

I'm sorry but I have to do this on a high visibility attractive project like RxJava.

If you do not respond to change request in a reasonable time, indicated by your public github activity profile, or your contribution causes an effort amplification (i.e., I now have to port your changes over to 4.x and do all sorts of extra steps for no apparent reason or benefit), you will be banned and publicly shamed.

@akarnokd akarnokd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please target 4.x first and we can discuss how much you, or anyone else needs this GC pedantic change backported into 3.x

@DragonFSKY

Copy link
Copy Markdown
Contributor Author

Thank you for the guidance. I have opened #8249 as a clean 4.x version of this change, targeting the current 4.x branch as requested. I am closing this PR as superseded, and I will only revisit a 3.x backport if there is a concrete need after the 4.x change is reviewed.

@DragonFSKY DragonFSKY closed this Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants