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

The new stacktrace printing is missing "repeated N times" info for some StackOverflows #37587

Closed
NHDaly opened this issue Sep 15, 2020 · 8 comments
Labels
bug Indicates an unexpected problem or unintended behavior error messages Better, more actionable error messages regression Regression in behavior compared to a previous version

Comments

@NHDaly
Copy link
Member

NHDaly commented Sep 15, 2020

On 1.5:

julia> versioninfo()
Julia Version 1.5.1
Commit 697e782ab8 (2020-08-25 20:08 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin19.6.0)
  CPU: Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)

julia> foo() = foo()
foo (generic function with 1 method)

julia> foo()
ERROR: StackOverflowError:
Stacktrace:
 [1] foo() at ./REPL[2]:1 (repeats 79984 times)

On master:

julia> versioninfo()
Julia Version 1.6.0-DEV.816
Commit 21ff6ee256 (2020-09-02 04:52 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin19.6.0)
  CPU: Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)

julia> foo() = foo()
foo (generic function with 1 method)

julia> foo()
ERROR:
StackOverflowError:
Stacktrace:
 [1] foo()
   @ Main ./REPL[4]:1

With a real, more interesting stack, this makes it difficult to tell where the cycle is occurring!

Note that it does sometimes work, as shown in this example:

julia> versioninfo()
Julia Version 1.6.0-DEV.816
Commit 21ff6ee256 (2020-09-02 04:52 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin19.6.0)
  CPU: Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)

julia> foo() = bar()
foo (generic function with 1 method)

julia> bar() = foo()
bar (generic function with 1 method)

julia> foo()
ERROR: StackOverflowError:
Stacktrace:
     [1] foo()
       @ Main ./REPL[1]:1
     [2] bar()
       @ Main ./REPL[2]:1--- the last 2 lines are repeated 13329 more times ---

😮 And i tried pulling a later master and re-building to see if the problem is still there before filing an issue, but now it's segfaulting! 😮

julia> versioninfo()
Julia Version 1.6.0-DEV.917
Commit a0a68a54d6 (2020-09-14 20:06 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin19.6.0)
  CPU: Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)

julia> foo() = foo()
foo (generic function with 1 method)

julia> foo()
[1]    88563 segmentation fault  ~/builds/julia-1.6/julia

When I ran inside LLDB it somehow didn't segfault, and indeed still suffers from the under-reporting of the repeated frames:

(lldb) r
Process 89582 launched: '/Users/nathandaly/builds/julia-1.6/julia' (x86_64)
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.6.0-DEV.917 (2020-09-14)
 _/ |\__'_|_|_|\__'_|  |  Commit a0a68a54d6 (0 days old master)
|__/                   |

julia> foo() = foo()
foo (generic function with 1 method)

julia> foo()
ERROR: StackOverflowError:
Stacktrace:
 [1] foo()
   @ Main ./REPL[1]:1

julia> versioninfo()
Julia Version 1.6.0-DEV.917
Commit a0a68a54d6 (2020-09-14 20:06 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin19.6.0)
  CPU: Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
@NHDaly
Copy link
Member Author

NHDaly commented Sep 15, 2020

(Also, i did a make clean and git pull and rebuilt master and it's not segfaulting anymore, so i hope that was just a false alarm? Still missing the "repeated N times" info of course)

julia> versioninfo()
Julia Version 1.6.0-DEV.917
Commit a0a68a54d6 (2020-09-14 20:06 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin19.6.0)
  CPU: Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)

julia> foo() = foo()
foo (generic function with 1 method)

julia> foo()
ERROR: StackOverflowError:
Stacktrace:
 [1] foo()
   @ Main ./REPL[3]:1

@NHDaly NHDaly changed the title The new stacktrace printing is aggregating duplicates but missing "repeated N times" info for StackOverflows (and maybe segfaults?) The new stacktrace printing missing "repeated N times" info for some StackOverflows Sep 15, 2020
@NHDaly NHDaly changed the title The new stacktrace printing missing "repeated N times" info for some StackOverflows The new stacktrace printing is missing "repeated N times" info for some StackOverflows Sep 15, 2020
@NHDaly
Copy link
Member Author

NHDaly commented Sep 15, 2020

(simplified the title)

@NHDaly NHDaly added bug Indicates an unexpected problem or unintended behavior error messages Better, more actionable error messages labels Dec 20, 2020
@NHDaly
Copy link
Member Author

NHDaly commented Dec 20, 2020

This bug is still present as of julia 1.6 alpha:

julia> versioninfo()
Julia Version 1.6.0-DEV.1780
Commit de69b02a48* (2020-12-19 19:43 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.7.0)
  CPU: Intel(R) Core(TM) i7-6920HQ CPU @ 2.90GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.0 (ORCJIT, skylake)

julia> foo() = foo()
foo (generic function with 1 method)

julia> foo()
ERROR: StackOverflowError:
Stacktrace:
 [1] foo()
   @ Main ./REPL[2]:1

@NHDaly
Copy link
Member Author

NHDaly commented Dec 20, 2020

@c42f: I know that you've made a lot of awesome improvements to exception stack trace printing this release! :) Do you have any idea what might have broken this?

Thanks!

@NHDaly
Copy link
Member Author

NHDaly commented Dec 20, 2020

I've checked, and the cycle detection still worked as of 97e3fe8, so the breakage is somewhere between 97e3fe8 and a0a68a5.

$ git log --oneline 97e3fe88d7..a0a68a54d6 -- base/errorshow.jl  | wc -l
      16

EDIT: Okay, i've tracked down the failure to #36134. That's where it was introduced 👍
See here for a before/after:
#36134 (comment)

30b09df [WIP] include ClearStacktrace.jl in Base (#36134)

@NHDaly NHDaly added the regression Regression in behavior compared to a previous version label Dec 20, 2020
@c42f
Copy link
Member

c42f commented Dec 21, 2020

Great sleuthing Nathan! I can't take credit for the great aesthetic improvements, those were all @jkrumbiegel's design work.

@jkrumbiegel do you have time to look at this? I'm pretty snowed under.

@NHDaly
Copy link
Member Author

NHDaly commented Jan 13, 2021

@jkrumbiegel: any chance you have time to look at this? :) hopefully it's not too much work to resolve?

@NHDaly NHDaly added the help wanted Indicates that a maintainer wants help on an issue or pull request label Jan 13, 2021
NHDaly added a commit to NHDaly/julia that referenced this issue Jan 24, 2021
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.
@NHDaly
Copy link
Member Author

NHDaly commented Jan 24, 2021

@c42f i've managed to track down the problem, and fixed it here:
#39378

it'd be great if we can also backport this into 1.6, once it's been exercised for a little while, so that stackoverflow printing isn't broken! :)

@NHDaly NHDaly removed the help wanted Indicates that a maintainer wants help on an issue or pull request label Jan 24, 2021
JeffBezanson pushed a commit that referenced this issue Mar 5, 2021
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 #37587.
JeffBezanson pushed a commit that referenced this issue Mar 9, 2021
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 #37587.
KristofferC pushed a commit that referenced this issue Mar 14, 2021
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 #37587.

Co-authored-by: Nathan Daly <nhdaly@gmail.com>
(cherry picked from commit 3276c11)
ElOceanografo pushed a commit to ElOceanografo/julia that referenced this issue May 4, 2021
)

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.

Co-authored-by: Nathan Daly <nhdaly@gmail.com>
antoine-levitt pushed a commit to antoine-levitt/julia that referenced this issue May 9, 2021
)

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.

Co-authored-by: Nathan Daly <nhdaly@gmail.com>
staticfloat pushed a commit that referenced this issue Dec 23, 2022
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 #37587.

Co-authored-by: Nathan Daly <nhdaly@gmail.com>
(cherry picked from commit 3276c11)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior error messages Better, more actionable error messages regression Regression in behavior compared to a previous version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants