-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Restore StackOverflow error message for repeated frames #39378
Restore StackOverflow error message for repeated frames #39378
Conversation
Fixes backtrace printing to display the number of times a frame is repeated, if there is a frame that's duplicated several times. ```julia julia> function foo() foo() end foo (generic function with 1 method) julia> foo() ERROR: StackOverflowError: Stacktrace: [1] foo() (repeats 79984 times) @ Main ./REPL[16]:1 ``` Fixes JuliaLang#37587.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks Nathan! :)
(Tentatively tagging for backport given this patch is a bugfix.) |
Great description of the problem, thanks! I'm not 100% sure this is the right fix — looking through the code, it seems the previous PR introduced Line 778 in dbaca8b
Line 653 in dbaca8b
Problem is, it uses What I wonder: should the test on |
Codecov Report
@@ Coverage Diff @@
## master #39378 +/- ##
==========================================
- Coverage 87.29% 87.18% -0.11%
==========================================
Files 388 389 +1
Lines 75292 74966 -326
==========================================
- Hits 65724 65361 -363
- Misses 9568 9605 +37
Continue to review full report at Codecov.
|
Hmm, i think there are two separate things to discuss here. The first is the one that I have (i believe) fixed in this PR:
Before #36134, the old code also had support for separate printing of short and long stack frames, and in the old code, they passed the number of repetitions,
I believe that this PR restores this functionality for the new organization of the code, and maintains the behavior of the old code. Does that sound correct to you? :) thanks! Second, you are saying that it uses
I don't think this is incorrect.. It seems that the #36134 preserved the logic that was there before, which also used I think that So I think #36134 handled the Does that make sense? Thanks @c42f! |
Sure, thanks for verifying that. Ok so I think this is fine in principle, it's just the failing tests which need some attention.
|
Thanks @c42f. For some reason, the tests weren't running before, until i closed and reopened so i hadn't seen the failures yet. I'll have a look later. Cheers! |
Eeeep, sorry I forgot about this PR - somehow it seemed like it was finished, in my mind. I've merged in the latest master. I'm a bit baffled by the test failures. I'm not sure how to resolve them given that they're not failing on macOS (where I am). |
If so, we can just delete the tests, or mark them macOS-only for now. Especially if this never worked, even on 1.5 on linux / windows. Then we can merge this PR to restore the old behavior, and file an issue that it doesn't work for linux32, linuxaarch64, and windows? |
Wowwww interesting! Yeah, on errorshow (6) | started at 2021-02-19T03:23:30.813
From worker 6: length: 2
From worker 6: length: 2
errorshow (6) | failed at 2021-02-19T03:23:41.597
Test Failed at /buildworker/worker/tester_linuxaarch64/build/share/julia/test/errorshow.jl:788
Expression: occursin(r"the last 2 lines are repeated \d+ more times", bt_str)
Evaluated: occursin(r"the last 2 lines are repeated \d+ more times", "\nStacktrace:\n [1] pair_repeater_a()\n @ Main.Test27Main_errorshow /buildworker/worker/tester_linuxaarch64/build/share/julia/test/errorshow.jl:769\n [2] pair_repeater_b()\n @ Main.Test27Main_errorshow /buildworker/worker/tester_linuxaarch64/build/share/julia/test/errorshow.jl:770") Whereas on macos64, it prints errorshow (3) | started at 2021-02-18T22:34:45.145
From worker 3: length: 79984
From worker 3: length: 79984
errorshow (3) | 34.41 | 0.17 | 0.5 | 525.74 | 2532.52 SO, I guess this is a problem upstream of how we display the back trace. Maybe this is why the original PR broke this behavior - perhaps the author was developing on Linux, and didn't see why we were handling a case of multiple stack frames that never occurs. ... Okay, in this case, I will adjust the newly added unit tests to only run on MacOS, for now, and then file an issue for why the backtrace return value is different on macos vs linux/windows. Does that sound alright with everyone? Sorry again for my delay - and thanks for the help, @c42f! |
373828c
to
dced572
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the linux 64 bit test was passing previously? It would be nice to re-enable that test, as it's a very common configuration.
Other than that, LGTM. Filing a separate issue for backtrace collection is a good idea.
Ah, good catch. How do I enable only linux 64 in the test itself from Julia?
It seemed finicky enough that I didn't bother.. :/
If you know how, can you send a suggestion or push up a commit directly?
Other than that I think this is ready to go! Thanks again for the help!
…On Mon, Feb 22, 2021, 8:18 PM Chris Foster ***@***.***> wrote:
***@***.**** approved this pull request.
I think the linux 64 bit test was passing previously? It would be nice to
re-enable that test, as it's a very common configuration.
Other than that, LGTM. Filing a separate issue for backtrace collection is
a good idea.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#39378 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMCIEICKLCFBUPKYGRDRK3TAL7ADANCNFSM4WQETDQQ>
.
|
Not sure if it's useful but the test works on 1.5 on Windows: julia> foo()
ERROR: StackOverflowError:
Stacktrace:
[1] foo() at .\REPL[1]:1 (repeats 79984 times)
julia> pair_repeater_a() = pair_repeater_b()
pair_repeater_a (generic function with 1 method)
julia> pair_repeater_b() = pair_repeater_a()
pair_repeater_b (generic function with 1 method)
julia> pair_repeater_a()
ERROR: StackOverflowError:
Stacktrace:
[1] pair_repeater_a() at .\REPL[3]:1
[2] pair_repeater_b() at .\REPL[4]:1
... (the last 2 lines are repeated 39990 more times)
[79983] pair_repeater_a() at .\REPL[3]:1 |
|
Ah I'd forgotten about this — sorry Nathan for not replying to your query. And thanks Jeff for pushing it through :-) |
Fixes backtrace printing to display the number of times a frame is
repeated, if there is a frame that's duplicated several times.
Fixes #37587.
Before #36134, the old code used to print the number of times a frame was repeated, here:
https://github.com/JuliaLang/julia/pull/36134/files#diff-2ad5106fcaed75e73fad677ef1b853010aa244fe4ca3969bc056eab7b9340f63L650
It looks like this count,
n
, accidentally got stripped out, here:https://github.com/JuliaLang/julia/pull/36134/files#diff-2ad5106fcaed75e73fad677ef1b853010aa244fe4ca3969bc056eab7b9340f63R778-R779
and then
n
was always hardcoded as1
:https://github.com/JuliaLang/julia/pull/36134/files#diff-2ad5106fcaed75e73fad677ef1b853010aa244fe4ca3969bc056eab7b9340f63R579
This PR restores the original behavior to pass
n
through toprint_stackframe()
. :)