Skip to content

Limit StackTraceCleaner cause traversal to prevent infinite loops - #1691

Open
arimu1 wants to merge 1 commit into
google:masterfrom
arimu1:fix/stacktrace-cleaner-infinite-cause-chains
Open

Limit StackTraceCleaner cause traversal to prevent infinite loops#1691
arimu1 wants to merge 1 commit into
google:masterfrom
arimu1:fix/stacktrace-cleaner-infinite-cause-chains

Conversation

@arimu1

@arimu1 arimu1 commented Aug 13, 2026

Copy link
Copy Markdown

Summary

  • Cap StackTraceCleaner related-throwable traversal at 1000 to prevent hangs when getCause() returns a new instance on each call (in addition to the existing identity-hash visited set for cyclic references).
  • Add infiniteCauseChainsAreHandled regression test mirroring the existing cyclesAreHandled test style.

Fixes #747

Test plan

  • mvn -pl core -Dtest=StackTraceCleanerTest test (22 tests, 0 failures)

Made with Cursor

StackTraceCleaner already guarded against cyclic cause references with
a visited set, but broken getCause() implementations that return a new
Throwable on each call could still hang. Cap related-throwable traversal
at 1000 and add a regression test.

Fixes google#747
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

StackTraceCleaner does not handle infinite cause chains

1 participant