Stack Overflow Error in Julia itself (type-inference)?

I have done the following test in Julia 1.5.3 and Julia 1.6.0-beta1.

$ git clone https://github.com/henriquebecker91/GuillotineModels.jl
$ cd GuillotineModels.jl/examples
$ git checkout 2c979b7f
$ wget https://pastebin.com/raw/pUWn5BJP
$ julia-1.6.0-beta1 --project=@.
julia> using Pkg
julia> Pkg.instantiate()
julia> using GuillotineModels, GLPK
julia> GuillotineModels.CommandLine.run(["G2CSP", "CPG_SSSCSP", "PPG2KP", "GLPK", "./pUWn5BJP", "--do-not-solve"])

The result is an unending error log starting with:

Internal error: encountered unexpected error in runtime:
StackOverflowError()
init_stenv at /buildworker/worker/package_linux64/build/src/subtype.c:1484 [inlined]
subtype_in_env_ at /buildworker/worker/package_linux64/build/src/subtype.c:1898
subtype_bounds_in_env at /buildworker/worker/package_linux64/build/src/subtype.c:1917 [inlined]
try_subtype_in_env at /buildworker/worker/package_linux64/build/src/subtype.c:2200 [inlined]
intersect_var at /buildworker/worker/package_linux64/build/src/subtype.c:2313
intersect at /buildworker/worker/package_linux64/build/src/subtype.c:3023
intersect_all at /buildworker/worker/package_linux64/build/src/subtype.c:3170
intersect_aside at /buildworker/worker/package_linux64/build/src/subtype.c:2147
intersect_var at /buildworker/worker/package_linux64/build/src/subtype.c:2316
intersect at /buildworker/worker/package_linux64/build/src/subtype.c:3023
intersect_all at /buildworker/worker/package_linux64/build/src/subtype.c:3170
intersect_aside at /buildworker/worker/package_linux64/build/src/subtype.c:2147
intersect_var at /buildworker/worker/package_linux64/build/src/subtype.c:2316
intersect at /buildworker/worker/package_linux64/build/src/subtype.c:3016
intersect_all at /buildworker/worker/package_linux64/build/src/subtype.c:3170
intersect_aside at /buildworker/worker/package_linux64/build/src/subtype.c:2147
var_lt at /buildworker/worker/package_linux64/build/src/subtype.c:589
subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1256
subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1254
subtype_tuple_tail at /buildworker/worker/package_linux64/build/src/subtype.c:1085
subtype_tuple at /buildworker/worker/package_linux64/build/src/subtype.c:1168 [inlined]
subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1323
with_tvar at /buildworker/worker/package_linux64/build/src/subtype.c:745

subtype_unionall at /buildworker/worker/package_linux64/build/src/subtype.c:839 [inlined]
subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1282
exists_subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1426 [inlined]
forall_exists_subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1454
subtype_in_env_ at /buildworker/worker/package_linux64/build/src/subtype.c:1907
subtype_bounds_in_env at /buildworker/worker/package_linux64/build/src/subtype.c:1917 [inlined]
try_subtype_in_env at /buildworker/worker/package_linux64/build/src/subtype.c:2200 [inlined]
intersect_var at /buildworker/worker/package_linux64/build/src/subtype.c:2313
intersect at /buildworker/worker/package_linux64/build/src/subtype.c:3019
intersect_all at /buildworker/worker/package_linux64/build/src/subtype.c:3170
intersect_aside at /buildworker/worker/package_linux64/build/src/subtype.c:2147
var_lt at /buildworker/worker/package_linux64/build/src/subtype.c:589
subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1256
exists_subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1426 [inlined]
forall_exists_subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1454
subtype_in_env_ at /buildworker/worker/package_linux64/build/src/subtype.c:1907
subtype_bounds_in_env at /buildworker/worker/package_linux64/build/src/subtype.c:1917 [inlined]
try_subtype_in_env at /buildworker/worker/package_linux64/build/src/subtype.c:2200 [inlined]
intersect_var at /buildworker/worker/package_linux64/build/src/subtype.c:2313
intersect at /buildworker/worker/package_linux64/build/src/subtype.c:3019
intersect_all at /buildworker/worker/package_linux64/build/src/subtype.c:3170
intersect_aside at /buildworker/worker/package_linux64/build/src/subtype.c:2147
var_lt at /buildworker/worker/package_linux64/build/src/subtype.c:589
subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1256
exists_subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1426 [inlined]
forall_exists_subtype at /buildworker/worker/package_linux64/build/src/subtype.c:1454
...

It is clear that it is a StackOverflowError, but seems to happen before my code starts executing. If I change GuillotineModels.jl/src/CommandLine.jl (l. 859) to add a println("entered run") before anything else, the message is not printed before the error log (this means: the first line of run is not even executed before the stack overflow happens). It really seems to me like a bug on Julia type-inference.

My questions are: Has someone experienced a similar bug? There is an workaround? How to debug this kinda of bug to find an workaround or something that may help Julia developers to solve this problem? (Would @snoopi_deep or something similar help with debugging?)

I am open to making any tests that may seem useful, I just don’t believe I will be able to make a MWE soon (but I will try at least to create some dummy data and call directly functions lower in the call stack).

Please do open an issue on GitHub, that way it doesn’t get lost. One thing that might be helpful here would be an rr trace, which you can record and upload by starting Julia with --bug-report=rr (available as of Julia 1.6).

2 Likes

Opened an issue, as suggested.

1 Like