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

Type intersection stack overflow testing StructuredOptimization.jl #47874

Closed
maleadt opened this issue Dec 12, 2022 · 3 comments
Closed

Type intersection stack overflow testing StructuredOptimization.jl #47874

maleadt opened this issue Dec 12, 2022 · 3 comments
Labels
bug Indicates an unexpected problem or unintended behavior types and dispatch Types, subtyping and method dispatch

Comments

@maleadt
Copy link
Member

maleadt commented Dec 12, 2022

The following MWE reproduces a stack overflow as seen on PkgEval, https://s3.amazonaws.com/julialang-reports/nanosoldier/pkgeval/by_date/2022-12/11/StructuredOptimization.primary.log:

pkg> activate --temp
pkg> add StructuredOptimization, FFTW

julia> using StructuredOptimization, FFTW
julia> using StructuredOptimization: ProximalOperators, AbstractOperators

julia> x = Tuple{Type{ProximalOperators.Precompose{_A, _B, _C, _D, _E, _F}} where _F where _E where _D where _C where _B where _A, ProximalOperators.NormL2{Int64}, AbstractOperators.DCT{1, Float64, FFTW.DCTPlan{Float64, 5, false}, FFTW.DCTPlan{Float64, 4, false}}, Float64, Union{AbstractArray{C, N} where N, C} where C<:Union{Base.Complex{R}, R} where R<:Real}
julia> y = Tuple{Type{ProximalOperators.Precompose{T, R, C, U, V, M}}, T, M, U, V} where M where V<:Union{AbstractArray{C, N} where N, C} where U<:Union{AbstractArray{R, N} where N, R} where C<:Union{Base.Complex{R}, R} where R<:Real where T<:ProximalOperators.ProximableFunction
julia> typeintersect(x, y)

ERROR: StackOverflowError:
Stacktrace:
 [1] typeintersect(a::Any, b::Any)
   @ Base ./reflection.jl:712
 [2] top-level scope
   @ REPL[23]:1

Looking at the rr trace (included in the PkgEval log), type intersection seems stuck:

(rr) f 56
#56 0x00007fc07b382c01 in subtype (x=0x1d86ae0, y=0x1d868e0, e=0x7ffe7f161fa0, param=<optimized out>) at /cache/build/default-amdci4-3/julialang/julia-master/src/subtype.c:1231
1231            return var_lt((jl_tvar_t*)x, y, e, param);
(rr) f 62
#62 0x00007fc07b382c01 in subtype (x=0x1d86ae0, y=0x1d868e0, e=0x7ffe7f161fa0, param=<optimized out>) at /cache/build/default-amdci4-3/julialang/julia-master/src/subtype.c:1231
1231            return var_lt((jl_tvar_t*)x, y, e, param);

(rr) C<:Union{Base.Complex{R<:Real}, R<:Real}
(rr) Union{AbstractArray{C<:Union{Base.Complex{R<:Real}, R<:Real}, N} where N, C<:Union{Base.Complex{R<:Real}, R<:Real}}

This also happens on 1.8, so isn't a regression, but it's consistently listed as a crash at the top of PkgEval reports so would be good to fix.

@maleadt maleadt added bug Indicates an unexpected problem or unintended behavior types and dispatch Types, subtyping and method dispatch labels Dec 12, 2022
@giordano
Copy link
Contributor

This also happens on 1.8, so isn't a regression

Might be a regression compared to older versions as tests were reportedly passing on nightly and 1.6 in July 2021: https://github.com/JuliaFirstOrder/StructuredOptimization.jl/commits/master

N5N3 added a commit to N5N3/julia that referenced this issue Dec 30, 2022
This fix the MWE reported in JuliaLang#47874 (comment)

And this fix the remaining internal error in `Healpix.jl`'s test.
N5N3 added a commit to N5N3/julia that referenced this issue Dec 30, 2022
This fix the MWE reported in JuliaLang#47874 (comment)

And this fix the remaining internal error in `Healpix.jl`'s test.

gc fix
N5N3 added a commit to N5N3/julia that referenced this issue Dec 31, 2022
This fix the MWE reported in JuliaLang#47874 (comment)

And this fix the remaining internal error in `Healpix.jl`'s test.

gc fix
N5N3 added a commit to N5N3/julia that referenced this issue Jan 3, 2023
This fixes the MWE reported in JuliaLang#47874 (comment)

And this fixes the remaining internal error in `Healpix.jl`'s test.

gc fix
@giordano
Copy link
Contributor

giordano commented Jan 7, 2023

@N5N3 was this fixed by #48029?

@N5N3
Copy link
Member

N5N3 commented Jan 7, 2023

No, that PR just fix the MWE above and my local test shows many remaining stack overflow.

Edit: MWE for remaining intersect issue

S1 = Tuple{Int, Vararg{Val{C} where C<:Union{Complex{R}, R}}} where R
T1 = Tuple{Any, Vararg{Val{C} where C<:Union{Complex{R}, R}}} where R<:Real
julia> typeintersect(S1, T1)
ERROR: StackOverflowError:

N5N3 added a commit to N5N3/julia that referenced this issue Jan 8, 2023
N5N3 added a commit to N5N3/julia that referenced this issue Jan 9, 2023
N5N3 added a commit to N5N3/julia that referenced this issue Jan 9, 2023
I gave up fixing the deep stack-overflow.
Make the `env` soundness seems much easier.

close JuliaLang#47874.
N5N3 added a commit to N5N3/julia that referenced this issue Jan 10, 2023
N5N3 added a commit to N5N3/julia that referenced this issue Jan 10, 2023
I gave up fixing the deep stack overflow.
Making the `env` soundness seems much easier.

close JuliaLang#47874.

At present, we only catch cases with pattern like
A1 = Union{T,Int} where {T}
A2 = Union{T2,Int} where {T,T2<:Union{T,Int}}
A3 = Union{Int,A2}
N5N3 added a commit to N5N3/julia that referenced this issue Jan 10, 2023
N5N3 added a commit to N5N3/julia that referenced this issue Jan 10, 2023
I gave up fixing the deep stack overflow.
Making the `env` soundness seems much easier.

close JuliaLang#47874.

At present, we only catch cases with pattern like
A1 = Union{T,Int} where {T}
A2 = Union{T2,Int} where {T,T2<:Union{T,Int}}
A3 = Union{Int,A2}
N5N3 added a commit to N5N3/julia that referenced this issue Jan 10, 2023
N5N3 added a commit to N5N3/julia that referenced this issue Jan 10, 2023
I gave up fixing the deep stack overflow.
Making the `env` soundness seems much easier.

close JuliaLang#47874.

At present, we only catch cases with pattern like
A1 = Union{T,Int} where {T}
A2 = Union{T2,Int} where {T,T2<:Union{T,Int}}
A3 = Union{Int,A2}
N5N3 added a commit to N5N3/julia that referenced this issue Jan 10, 2023
N5N3 added a commit to N5N3/julia that referenced this issue Jan 10, 2023
I gave up fixing the deep stack overflow.
Making the `env` soundness seems much easier.

close JuliaLang#47874.

At present, we only catch cases with pattern like
A1 = Union{T,Int} where {T}
A2 = Union{T2,Int} where {T,T2<:Union{T,Int}}
A3 = Union{Int,A2}
N5N3 added a commit to N5N3/julia that referenced this issue Jan 10, 2023
N5N3 added a commit to N5N3/julia that referenced this issue Jan 10, 2023
I gave up fixing the deep stack overflow.
Making the `env` soundness seems much easier.

close JuliaLang#47874.

At present, we only catch cases with pattern like
A1 = Union{T,Int} where {T}
A2 = Union{T2,Int} where {T,T2<:Union{T,Int}}
A3 = Union{Int,A2}
N5N3 added a commit to N5N3/julia that referenced this issue Jan 10, 2023
N5N3 added a commit to N5N3/julia that referenced this issue Jan 10, 2023
I gave up fixing the deep stack overflow.
Making the `env` soundness seems much easier.

close JuliaLang#47874.

At present, we only catch cases with pattern like
A1 = Union{T,Int} where {T}
A2 = Union{T2,Int} where {T,T2<:Union{T,Int}}
A3 = Union{Int,A2}
N5N3 added a commit to N5N3/julia that referenced this issue Jan 10, 2023
N5N3 added a commit to N5N3/julia that referenced this issue Jan 10, 2023
I gave up fixing the deep stack overflow.
Making the `env` soundness seems much easier.

close JuliaLang#47874.

At present, we only catch cases with pattern like
A1 = Union{T,Int} where {T}
A2 = Union{T2,Int} where {T,T2<:Union{T,Int}}
A3 = Union{Int,A2}
N5N3 added a commit to N5N3/julia that referenced this issue Jan 10, 2023
N5N3 added a commit to N5N3/julia that referenced this issue Jan 10, 2023
I gave up fixing the deep stack overflow.
Making the `env` soundness seems much easier.

close JuliaLang#47874.

At present, we only catch cases with pattern like
A1 = Union{T,Int} where {T}
A2 = Union{T2,Int} where {T,T2<:Union{T,Int}}
A3 = Union{Int,A2}
N5N3 added a commit to N5N3/julia that referenced this issue Jan 10, 2023
I gave up fixing the deep stack overflow.
Making the `env` soundness seems much easier.

close JuliaLang#47874.

At present, we only catch cases with pattern like
A1 = Union{T,Int} where {T}
A2 = Union{T2,Int} where {T,T2<:Union{T,Int}}
A3 = Union{Int,A2}
@N5N3 N5N3 closed this as completed in 04cb6fb Jan 10, 2023
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 types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

No branches or pull requests

3 participants