Open matthiaskrgr opened 1 year ago
I tried to bisect no crash: 2c1b65ee1431f8d3fe2142e821eb13c623bbf8a0 / #115694 crash: a04d56b36d8f634abd7bdd64dd859a30655f1818 / #117817
which seems quite odd :confused:
What if you pass -Zparse-only
during bisection?
Still overflows unfortunately
~/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/rustc snippet_192.rs -Zparse-only
error: rustc interrupted by SIGSEGV, printing backtrace
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x2d09ac6)[0x7fdfe3509ac6]
/usr/lib/libc.so.6(+0x3e710)[0x7fdfe065c710]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/rustc(+0x4fddc)[0x55d8a28a5ddc]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/rustc(+0x4e2d3)[0x55d8a28a42d3]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/rustc(+0x4e0e3)[0x55d8a28a40e3]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/rustc(+0x59985)[0x55d8a28af985]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/rustc(+0x588f7)[0x55d8a28ae8f7]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/rustc(+0x25b62)[0x55d8a287bb62]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/rustc(+0x55ac5)[0x55d8a28abac5]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/rustc(+0x1a87d)[0x55d8a287087d]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x43ed12a)[0x7fdfe4bed12a]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-a2929300a34289e9.so(_RNvMNtNtCsiucHKcZsReC_11rustc_parse6parser4stmtNtB4_6Parser27parse_stmt_without_recovery+0x1738)[0x7fdfe4ef0106]
### cycle encountered after 12 frames with period 14
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-a2929300a34289e9.so(_RNvMNtNtCsiucHKcZsReC_11rustc_parse6parser4stmtNtB4_6Parser15parse_full_stmt+0x42)[0x7fdfe4eed860]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x46ea2a3)[0x7fdfe4eea2a3]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x46e8fbe)[0x7fdfe4ee8fbe]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x41c092c)[0x7fdfe49c092c]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x41bb466)[0x7fdfe49bb466]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-a2929300a34289e9.so(_RNvMs0_NtNtCsiucHKcZsReC_11rustc_parse6parser4exprNtB7_6Parser21parse_expr_assoc_with+0x7e)[0x7fdfe49b7afe]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-a2929300a34289e9.so(_RNvMNtNtCsiucHKcZsReC_11rustc_parse6parser4stmtNtB4_6Parser27parse_stmt_without_recovery+0x1844)[0x7fdfe4ef0212]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-a2929300a34289e9.so(_RNvMNtNtCsiucHKcZsReC_11rustc_parse6parser4stmtNtB4_6Parser15parse_full_stmt+0x42)[0x7fdfe4eed860]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x46ea2a3)[0x7fdfe4eea2a3]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x46e8fbe)[0x7fdfe4ee8fbe]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x41c092c)[0x7fdfe49c092c]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x41bb466)[0x7fdfe49bb466]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-a2929300a34289e9.so(_RNvMs0_NtNtCsiucHKcZsReC_11rustc_parse6parser4exprNtB7_6Parser21parse_expr_assoc_with+0x7e)[0x7fdfe49b7afe]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-a2929300a34289e9.so(_RNvMNtNtCsiucHKcZsReC_11rustc_parse6parser4stmtNtB4_6Parser27parse_stmt_without_recovery+0x1844)[0x7fdfe4ef0212]
### recursed 17 times
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-a2929300a34289e9.so(_RNvMNtNtCsiucHKcZsReC_11rustc_parse6parser4stmtNtB4_6Parser15parse_full_stmt+0x42)[0x7fdfe4eed860]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x46ea2a3)[0x7fdfe4eea2a3]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x46e8fbe)[0x7fdfe4ee8fbe]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x41c092c)[0x7fdfe49c092c]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x41bb466)[0x7fdfe49bb466]
/home/matthias/.rustup/toolchains/bisector-ci-a04d56b36d8f634abd7bdd64dd859a30655f1818-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-a2929300a34289e9.so(_RNvMs0_NtNtCsiucHKcZsReC_11rustc_parse6parser4exprNtB7_6Parser21parse_expr_assoc_with+0x7e)[0x7fdfe49b7afe]
note: rustc unexpectedly overflowed its stack! this is a bug
note: maximum backtrace depth reached, frames may have been lost
note: we would appreciate a report at https://github.com/rust-lang/rust
note: backtrace dumped due to SIGSEGV! resuming signal
[1] 1537650 segmentation fault snippet_192.rs -Zparse-only
Yea, cuz it overflows in the parser but maybe it leads to a different commit? If it's “flaky”?
I have tried stable, beta, nightly and none of them stack overflow. With https://github.com/rust-lang/rust/commit/2c1b65ee1431f8d3fe2142e821eb13c623bbf8a0 , I did not manage to get a SO with or without -Zparse-only
With https://github.com/rust-lang/rust/commit/a04d56b36d8f634abd7bdd64dd859a30655f1818 I get a SO 100% of the time regardless of -Zparse-only
I also tried a debug-assertion build which is 1-2 days old and saw no stack overflow there, I can update it and try to see if I can see anything interesting with gdb there
a04d56b36d8f634abd7bdd64dd859a30655f1818 built with debug assertions does not stack overflow for me ¯_(ツ)_/¯
Does varying the number of curlies affect the bisection results?
fwiw, on x86_64-apple-darwin, with 4000 curly-pairs instead of 1000, it crashes with a stack overflow at least as far back as 2019-01-01
I can take away a couple of {}s and it stops SOing on https://github.com/rust-lang/rust/commit/a04d56b36d8f634abd7bdd64dd859a30655f1818 but adding more than 50 pairs or so on nightly does not suddenly trigger the SO from what I see
While the stack trace says otherwise, I assume this has to do with the fact that rustc_ast_passes
and possibly other AST validation compiler stages aren't properly guarded against stack overflows.
My PR added & removed some function calls & closures and apparently in total this resulted in a faster growing stack. That's my explanation. I'm pretty sure that I've seen at least on super similar issue on this issue tracker (one which hasn't been fixed yet).
Update: The code from the issue description which contains 1000 pairs of curly braces no longer overflows but updating it to e.g. 1077 pairs does still lead to one. Of course, this issue should be kept open. I will experiment with sprinkling calls to ensure_sufficient_stack
inside AstValidator
which I've confirmed to be the culprit (eh, it's more complicated than that).
code:
Version information
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
``` error: rustc interrupted by SIGSEGV, printing backtrace /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x2d09ac6)[0x7f567df09ac6] /usr/lib/libc.so.6(+0x3e710)[0x7f567b052710] /home/matthias/.rustup/toolchains/master/bin/rustc(+0x4fddc)[0x5637f54f0ddc] /home/matthias/.rustup/toolchains/master/bin/rustc(+0x4e2d3)[0x5637f54ef2d3] /home/matthias/.rustup/toolchains/master/bin/rustc(+0x4e0e3)[0x5637f54ef0e3] /home/matthias/.rustup/toolchains/master/bin/rustc(+0x59985)[0x5637f54fa985] /home/matthias/.rustup/toolchains/master/bin/rustc(+0x588f7)[0x5637f54f98f7] /home/matthias/.rustup/toolchains/master/bin/rustc(+0x25b62)[0x5637f54c6b62] /home/matthias/.rustup/toolchains/master/bin/rustc(+0x55ac5)[0x5637f54f6ac5] /home/matthias/.rustup/toolchains/master/bin/rustc(+0x1a87d)[0x5637f54bb87d] /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x43ed12a)[0x7f567f5ed12a] /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-a2929300a34289e9.so(_RNvMNtNtCsiucHKcZsReC_11rustc_parse6parser4stmtNtB4_6Parser27parse_stmt_without_recovery+0x1738)[0x7f567f8f0106] ### cycle encountered after 12 frames with period 14 /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-a2929300a34289e9.so(_RNvMNtNtCsiucHKcZsReC_11rustc_parse6parser4stmtNtB4_6Parser15parse_full_stmt+0x42)[0x7f567f8ed860] /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x46ea2a3)[0x7f567f8ea2a3] /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x46e8fbe)[0x7f567f8e8fbe] /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x41c092c)[0x7f567f3c092c] /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x41bb466)[0x7f567f3bb466] /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-a2929300a34289e9.so(_RNvMs0_NtNtCsiucHKcZsReC_11rustc_parse6parser4exprNtB7_6Parser21parse_expr_assoc_with+0x7e)[0x7f567f3b7afe] /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-a2929300a34289e9.so(_RNvMNtNtCsiucHKcZsReC_11rustc_parse6parser4stmtNtB4_6Parser27parse_stmt_without_recovery+0x1844)[0x7f567f8f0212] /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-a2929300a34289e9.so(_RNvMNtNtCsiucHKcZsReC_11rustc_parse6parser4stmtNtB4_6Parser15parse_full_stmt+0x42)[0x7f567f8ed860] /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x46ea2a3)[0x7f567f8ea2a3] /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x46e8fbe)[0x7f567f8e8fbe] /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x41c092c)[0x7f567f3c092c] /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x41bb466)[0x7f567f3bb466] /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-a2929300a34289e9.so(_RNvMs0_NtNtCsiucHKcZsReC_11rustc_parse6parser4exprNtB7_6Parser21parse_expr_assoc_with+0x7e)[0x7f567f3b7afe] /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-a2929300a34289e9.so(_RNvMNtNtCsiucHKcZsReC_11rustc_parse6parser4stmtNtB4_6Parser27parse_stmt_without_recovery+0x1844)[0x7f567f8f0212] ### recursed 17 times /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-a2929300a34289e9.so(_RNvMNtNtCsiucHKcZsReC_11rustc_parse6parser4stmtNtB4_6Parser15parse_full_stmt+0x42)[0x7f567f8ed860] /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x46ea2a3)[0x7f567f8ea2a3] /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x46e8fbe)[0x7f567f8e8fbe] /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x41c092c)[0x7f567f3c092c] /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-a2929300a34289e9.so(+0x41bb466)[0x7f567f3bb466] /home/matthias/.rustup/toolchains/master/bin/../lib/librustc_driver-a2929300a34289e9.so(_RNvMs0_NtNtCsiucHKcZsReC_11rustc_parse6parser4exprNtB7_6Parser21parse_expr_assoc_with+0x7e)[0x7f567f3b7afe] note: rustc unexpectedly overflowed its stack! this is a bug note: maximum backtrace depth reached, frames may have been lost note: we would appreciate a report at https://github.com/rust-lang/rust note: backtrace dumped due to SIGSEGV! resuming signal [1] 549493 segmentation fault ~/.rustup/toolchains/master/bin/rustc snippet_192.rs ```