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

Infinitely growing compilation recursion #16201

Closed
andreasnoack opened this issue May 4, 2016 · 8 comments · Fixed by #16288
Closed

Infinitely growing compilation recursion #16201

andreasnoack opened this issue May 4, 2016 · 8 comments · Fixed by #16288
Assignees
Labels
compiler:codegen Generation of LLVM IR and native code kind:bug Indicates an unexpected problem or unintended behavior
Milestone

Comments

@andreasnoack
Copy link
Member

andreasnoack commented May 4, 2016

On 0.4 I get

julia> UpperTriangular(randn(3,3))\sub(randn(3), [1,2,3])
ERROR: StackOverflowError:
 in \ at linalg/generic.jl:323
 in \ at linalg/generic.jl:326 (repeats 74845 times)

but on 0.5.0-dev+3878 (2016-05-04 17:25 UTC) Julia just hangs and I cannot break out of recursion so I have to kill Julia.

Update: This is on OS X.

@andreasnoack andreasnoack changed the title StackOverflowError exception not thrown on 0.5 StackOverflowError exception not thrown on 0.5- May 4, 2016
@andreasnoack andreasnoack added the kind:regression Regression in behavior compared to a previous version label May 4, 2016
@yuyichao
Copy link
Contributor

yuyichao commented May 4, 2016

What happens when you run this in a debugger?

@vtjnash
Copy link
Sponsor Member

vtjnash commented May 4, 2016

it's sitting in an infinitely growing compilation recursion, for example:
Base.LinAlg.\(Base.#\, Base.LinAlg.LowerTriangular{Float64, Base.LinAlg.UpperTriangular{Float64, Base.LinAlg.LowerTriangular{Float64, Base.LinAlg.UpperTriangular{Float64, Base.LinAlg.LowerTriangular{Float64, Base.LinAlg.UpperTriangular{Float64, Base.LinAlg.LowerTriangular{Float64, Base.LinAlg.UpperTriangular{Float64, Base.LinAlg.LowerTriangular{Float64, Base.LinAlg.UpperTriangular{Float64, Base.LinAlg.LowerTriangular{Float64, Base.LinAlg.UpperTriangular{Float64, Base.LinAlg.LowerTriangular{Float64, Base.LinAlg.UpperTriangular{Float64, Base.LinAlg.LowerTriangular{Float64, Base.LinAlg.UpperTriangular{Float64, Base.LinAlg.LowerTriangular{Float64, Base.LinAlg.UpperTriangular{Float64, Base.LinAlg.LowerTriangular{Float64, Base.LinAlg.UpperTriangular{Float64, Base.LinAlg.LowerTriangular{Float64, Base.LinAlg.UpperTriangular{Float64, Base.LinAlg.LowerTriangular{Float64, Base.LinAlg.UpperTriangular{Float64, Base.LinAlg.LowerTriangular{Float64, Base.LinAlg.UpperTriangular{Float64, Base.LinAlg.LowerTriangular{Float64, Base.LinAlg.UpperTriangular{Float64, Base.LinAlg.LowerTriangular{Float64, Base.LinAlg.UpperTriangular{Float64, Base.LinAlg.LowerTriangular{Float64, Base.LinAlg.UpperTriangular{Float64, Base.LinAlg.LowerTriangular{Float64, Base.LinAlg.UpperTriangular{Float64, Array{Float64, 2}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}, Base.SubArray{Float64, 1, Array{Float64, 1}, Tuple{Array{Int64, 1}}, false})

@yuyichao
Copy link
Contributor

yuyichao commented May 4, 2016

Regression on #14009 ?

@vtjnash
Copy link
Sponsor Member

vtjnash commented May 4, 2016

probably related, yes. but this is in codegen, not inference.

@andreasnoack
Copy link
Member Author

This bug complicates the work in #6837 because I have to kill Julia when a method is missing. It's a slow process to figure out if the tests are just slow (like the 15 minutes of triangular.jl) or if they are hanging because of this issue.

@andreasnoack
Copy link
Member Author

andreasnoack commented May 6, 2016

I've bisected this and there seems to two issues. When executing

UpperTriangular(randn(3,3))\sub(randn(3), [1,2,3])
  1. My changes in 87e26c5 cause an infinite loop in inference instead of an instant StackOverflowError but it is still possible to break out of the loop with ctrl+c.
  2. @vtjnash's changes in 8f4238a make the hang fatal and Julia has to be killed.

Right now, I'm working on a fix for the specific statement above such the dispatch isn't recursive but I would still expect that the behavior in 1. and 2. are bugs, i.e. type inference should never go into an infinite loop and you should always be able to break out of a loop with ctrl+c.

@andreasnoack andreasnoack changed the title StackOverflowError exception not thrown on 0.5- Infinitely growing compilation recursion should throw an error May 10, 2016
@andreasnoack
Copy link
Member Author

This is kind of fixed by #16288. I've changed the title to reflect the issue with infinite compilation recursions. Isn't there a way to detect this?

@JeffBezanson JeffBezanson reopened this May 28, 2016
@JeffBezanson JeffBezanson added compiler:codegen Generation of LLVM IR and native code kind:bug Indicates an unexpected problem or unintended behavior labels May 28, 2016
@JeffBezanson JeffBezanson added this to the 0.5.0 milestone May 28, 2016
@JeffBezanson JeffBezanson changed the title Infinitely growing compilation recursion should throw an error Infinitely growing compilation recursion May 28, 2016
@tkelman tkelman added the needs tests Unit tests are required for this change label Jun 2, 2016
@StefanKarpinski
Copy link
Sponsor Member

TODO: add the test case to #16692.

@vtjnash vtjnash removed needs tests Unit tests are required for this change kind:regression Regression in behavior compared to a previous version labels Jun 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:codegen Generation of LLVM IR and native code kind:bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants