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

apparent compilation hang in 1.9.0+rc2 #49323

Closed
lmiq opened this issue Apr 11, 2023 · 4 comments · Fixed by #49345
Closed

apparent compilation hang in 1.9.0+rc2 #49323

lmiq opened this issue Apr 11, 2023 · 4 comments · Fixed by #49345
Labels
regression Regression in behavior compared to a previous version types and dispatch Types, subtyping and method dispatch
Milestone

Comments

@lmiq
Copy link
Contributor

lmiq commented Apr 11, 2023

Maybe related to: #49321

Apparently compilation is hanging when I'm trying to use the JSON3 package in Julia 1.9.0-rc2.

The minimal script to reproduce the bug is:

import Pkg
Pkg.activate(temp=true)
Pkg.add("ComplexMixtures")
using ComplexMixtures
ComplexMixtures.load("./test.txt")

where the input file is: test.txt

I have installed 1.9.0-rc1 and 1.9.0-rc2 using juliaup, and I run:

julia +1.9.0-rc1 script.jl
#or
julia +1.9.0-rc2 script.jl

in rc2 the execution hangs (it works in 1.6, 1.8.5 and 1.9.0-rc1).

If I kill the execution I get the following stack trace: stacktrace.txt

The function in case is this one: https://github.com/m3g/ComplexMixtures.jl/blob/ea0d48880c08b6178034fa7c603ec03eefa186eb/src/results.jl#L679

but I don't think it has anything to do with the bug.

I suspect that the problem is compilation because if I add @show statements in that function, even in the first line, they don't get immediately printed.

@lmiq
Copy link
Contributor Author

lmiq commented Apr 11, 2023

Here is a "more minimal" example.

The script hangs, as above.

it does not hang if I replace @with_kw from Paramters.jl by the base @kwdef.

Thus, this bug may be related to Parameters.jl, in association with some change in rc1.

Run the example with:

julia +1.9.0-rc2 minimal1.jl

with test.txt in the directory. The files are available in the zip: minimal1.zip

I will try to make the example shorter.

edit: tentatives to simplify the structure tend to make the test pass. I noted that for a relatively complex data structure the test passes but may take a long time (while being fast in other Julia versions than 1.9.0-rc2).

Maybe the code is not completely stalled, but just taking way too long.

@maleadt
Copy link
Member

maleadt commented Apr 12, 2023

2a2068d2677eae3fe2101c89f9ed6c98e51f3a62 is the first bad commit
commit 2a2068d2677eae3fe2101c89f9ed6c98e51f3a62
Author: N5N3 <2642243996@qq.com>
Date:   Thu Feb 2 11:41:26 2023 +0800

    Subtype: avoid false alarm caused by eager `forall_exists_subtype`. (#48441)

ref #48441, cc @N5N3

Doesn't happen on master, so let's see if I can bisect a fix.

@maleadt maleadt added regression Regression in behavior compared to a previous version compiler:inference Type inference and removed bisect wanted labels Apr 12, 2023
@maleadt maleadt added this to the 1.9 milestone Apr 12, 2023
@maleadt
Copy link
Member

maleadt commented Apr 12, 2023

3d0278b7b2e4cb62323ef4d5b2222737522d2690 is the first fixed commit
commit 3d0278b7b2e4cb62323ef4d5b2222737522d2690
Author: N5N3 <2642243996@qq.com>
Date:   Thu Feb 2 14:13:49 2023 +0800

    Subtype: skip more identical check for `X::Tuple <: Y::Tuple`

So back-port #48534?

@N5N3
Copy link
Member

N5N3 commented Apr 13, 2023

MWE

S = Tuple{Type{Result{Vector{Float64}}}, Union{Nothing, Int64}, Union{Nothing, Float64}, Union{Nothing, Float64}, Union{Nothing, Vector{Float64}}, Union{Nothing, Vector{Float64}}, Union{Nothing, Vector{Float64}}, Union{Nothing, Vector{Float64}}, Union{Nothing, Vector{Float64}}, Union{Nothing, Vector{Float64}}, Union{Nothing, Vector{Float64}}, Union{Nothing, Bool}, Union{Nothing, ComplexMixtures.SolSummary}, Union{Nothing, ComplexMixtures.SolSummary}, Union{Nothing, Vector{Float64}}, Union{Nothing, Vector{Float64}}, Union{Nothing, Vector{Float64}}, Union{Nothing, Vector{Float64}}, Union{Nothing, Vector{Float64}}, Union{Nothing, Vector{Float64}}, Union{Nothing, Vector{Float64}}, Union{Nothing, Vector{Float64}}, Union{Nothing, ComplexMixtures.Density}, Union{Nothing, ComplexMixtures.Volume}, Union{Nothing, Options}, Union{Nothing, Int64}, Union{Nothing, Int64}, Union{Nothing, Int64}, Union{Nothing, Vector{String}}, Union{Nothing, Vector{Float64}}}
T = Tuple{Type{Result{T1}}, Vararg{Any, 29}} where T1
S <: T

Looks like the fake union split on T1 blocks the separatable subtyping.

@N5N3 N5N3 added types and dispatch Types, subtyping and method dispatch and removed compiler:inference Type inference labels Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression Regression in behavior compared to a previous version types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants