Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-9332] Stack overflow in SwiftSyntax due to deep recursion #426

jpsim opened this issue Nov 24, 2018 · 0 comments

[SR-9332] Stack overflow in SwiftSyntax due to deep recursion #426

jpsim opened this issue Nov 24, 2018 · 0 comments


Copy link

@jpsim jpsim commented Nov 24, 2018

Previous ID SR-9332
Radar None
Original Reporter @jpsim
Type Bug
Additional Detail from JIRA
Votes 0
Component/s SwiftSyntax
Labels Bug
Assignee None
Priority Medium

md5: 46d095af8127f00fe7ff16b9a8489020

Issue Description:

Due to the recursion in SwiftSyntax's SyntaxVisitor, it's easy to trigger a stack overflow due to too much recursive calls. This is especially easy to trigger if you run visitors on multiple threads concurrently, if you compile with a debug configuration or if you run with tsan. For example:

==720==ERROR: ThreadSanitizer: stack-overflow on address 0x7e8000189b00 (pc 0x00010601afd1 bp 0x7e800018c790 sp 0x7e8000186e50 T10952)
    #​0 SyntaxVisitor.visit(_:) SyntaxRewriter.swift:1699 (libSwiftSyntax.dylib:x86_64+0x683fd0)

SUMMARY: ThreadSanitizer: stack-overflow SyntaxRewriter.swift:1699 in SyntaxVisitor.visit(_:)
Received 'abort trap' signal

Example here: realm/SwiftLint#2480

If it would help, I can take some time to create a more focused repro case, just ask.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants