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

StackOverflow when displaying recursive output causes segfault #10353

Closed
pito-svk opened this issue Feb 27, 2015 · 9 comments
Closed

StackOverflow when displaying recursive output causes segfault #10353

pito-svk opened this issue Feb 27, 2015 · 9 comments
Labels
bug Indicates an unexpected problem or unintended behavior system:linux Affects only Linux

Comments

@pito-svk
Copy link

Hi, I am not sure if this is a bug, but it looks like it is.

Simple:
you have an array let's say

a = []
push!(a, a)
  • it causes me chain of Segmentation fault errors and terminate REPL and later when I write something in terminal - my input and output is in bold for some time.
    screenshot from 2015-02-27 13 52 55

Please correct me, if this isn't a bug.

Thanks.

@Keno
Copy link
Member

Keno commented Feb 27, 2015

It's a stack overflow, but that's fine, it should just throw an error.

@Keno Keno added the bug Indicates an unexpected problem or unintended behavior label Feb 27, 2015
@jakebolewski
Copy link
Member

This works for me on 0.4. @pito-svk are you on windows? Can you post the output of versioninfo()?

julia> a = []
0-element Array{Any,1}

julia> push!(a, a)
1-element Array{Any,1}:
Error showing value of type Array{Any,1}:
ERROR: StackOverflowError:

@ivarne
Copy link
Member

ivarne commented Feb 27, 2015

Note that the bug likely is in the printing of the resulting recursive array, not in creating it.

@pito-svk
Copy link
Author

@jakebolewski no, ubuntu:

Julia Version 0.4.0-dev+3533
Commit f875a54 (2015-02-22 20:56 UTC)
DEBUG build
Platform Info:
  System: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i7-4510U CPU @ 2.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

@ivarne right (in script):

a = []
push!(a, a)
print(a) # this causes error

or this:

a = []
push!(a, a)
@printf("%d", a) # also

@jakebolewski
Copy link
Member

Although this is a legit stack overflow bug, we could print something like

julia> a = []
0-element Array{Any,1}

julia> push!(a, a)
1-element Array{Any,1}:
 Any[#= circular reference =#]

here to avoid the overflow just by checking is(x, itr) in show_delim_array

@ihnorton
Copy link
Member

This may be specific to llvm 3.3; I can reproduce there, but on llvm 3.5 I get a proper error.

@pito-svk
Copy link
Author

@jakebolewski Right. For example python prints this:

[[...]]

...and javascript:

[ [Circular] ]

@jakebolewski jakebolewski changed the title Julia - push! terminate REPL StackOverflow when displaying recursive output causes segfault Feb 27, 2015
@jiahao
Copy link
Member

jiahao commented Feb 27, 2015

Related: #3831

@Keno
Copy link
Member

Keno commented Jan 11, 2016

This one should probably be closed already, given that the original issue was fixed to not overflow the stack.

@Keno Keno closed this as completed Jan 11, 2016
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 system:linux Affects only Linux
Projects
None yet
Development

No branches or pull requests

6 participants