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

1.9 hang in compiler during subtyping / type intersection #49321

Closed
NHDaly opened this issue Apr 11, 2023 · 1 comment
Closed

1.9 hang in compiler during subtyping / type intersection #49321

NHDaly opened this issue Apr 11, 2023 · 1 comment
Labels
compiler:codegen Generation of LLVM IR and native code regression Regression in behavior compared to a previous version types and dispatch Types, subtyping and method dispatch

Comments

@NHDaly
Copy link
Member

NHDaly commented Apr 11, 2023

I'm not sure if it's related to #49127 or not (it seems like not, since we are seeing this on 1.9), but we recently saw a build hang in CI on 1.9 for 30 min before being killed.

(This was during our PackageCompiler precompilation, in case it's relevant.)

I'm not sure if it's reproducible yet; I've restarted the build now.

Thankfully, we set up our builds to dump stack traces when timing out, and we captured this:

Thread 5 (Thread 0x7fffe044d640 (LWP 6759) "julia"):
#0  lookup (v=0x7fffe84229a0 <jl_system_image_data+77351264>, e=0x7edddffdb870) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/subtype.c:121
#1  var_gt (b=<optimized out>, a=0x7fffbbfc9cd0, e=0x7edddffdb870, param=0) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/subtype.c:672
#2  0x00007ffff7368e51 in local_forall_exists_subtype (x=x@entry=0x7fffa3475cd0, y=y@entry=0x7fffe84229a0 <jl_system_image_data+77351264>, e=e@entry=0x7edddffdb870, param=param@entry=0, limit_slow=limit_slow@entry=0) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/subtype.c:1421
#3  0x00007ffff7369823 in forall_exists_equal (x=0x7fffe84229a0 <jl_system_image_data+77351264>, y=0x7fffa3475cd0, e=e@entry=0x7edddffdb870) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/subtype.c:1450
#4  0x00007ffff7362fd2 in subtype (x=<optimized out>, y=0x7fffbebd1dd0, e=0x7edddffdb870, param=<optimized out>) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/subtype.c:1327
#5  0x00007ffff736a677 in subtype_unionall (t=0x7fffbebd1dd0, u=<optimized out>, e=0x7edddffdb870, R=<optimized out>, param=0) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/subtype.c:808
#6  0x00007ffff7363dfc in exists_subtype (param=0, se=0x7edddffdb260, saved=0x7edd7cf7ad90, e=0x7edddffdb870, y=0x7fffbebd1dd0, x=0x7fffe8422840 <jl_system_image_data+77350912>) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/subtype.c:1464
#7  _forall_exists_subtype (x=x@entry=0x7fffe8422840 <jl_system_image_data+77350912>, y=y@entry=0x7fffbebd1dd0, e=e@entry=0x7edddffdb870, param=param@entry=0, count=count@entry=0x7edddffdb310, noRmore=noRmore@entry=0x7edddffdb314) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/subtype.c:1496
#8  0x00007ffff7369012 in local_forall_exists_subtype (x=x@entry=0x7fffe8422840 <jl_system_image_data+77350912>, y=y@entry=0x7fffbebd1dd0, e=e@entry=0x7edddffdb870, param=param@entry=0, limit_slow=limit_slow@entry=0) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/subtype.c:1406
#9  0x00007ffff7369823 in forall_exists_equal (x=0x7fffbebd1dd0, y=0x7fffe8422840 <jl_system_image_data+77350912>, e=e@entry=0x7edddffdb870) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/subtype.c:1450
#10 0x00007ffff7362fd2 in subtype (x=<optimized out>, y=0x7fffe84227e0 <jl_system_image_data+77350816>, e=0x7edddffdb870, param=<optimized out>) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/subtype.c:1327
#11 0x00007ffff7363150 in subtype_tuple_tail (R=0 '\000', param=1, e=0x7edddffdb870, yd=0x7fffe84226f0 <jl_system_image_data+77350576>, xd=0x7edd7cf6b150) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/subtype.c:1105
#12 subtype_tuple (param=1, e=0x7edddffdb870, yd=0x7fffe84226f0 <jl_system_image_data+77350576>, xd=<optimized out>) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/subtype.c:1184
#13 subtype (x=<optimized out>, y=0x7fffe84226f0 <jl_system_image_data+77350576>, e=0x7edddffdb870, param=<optimized out>) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/subtype.c:1320
#14 0x00007ffff736a57b in subtype_unionall (t=0x7edd7cf6b150, u=<optimized out>, e=0x7edddffdb870, R=<optimized out>, param=0) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/subtype.c:801
#15 0x00007ffff736a57b in subtype_unionall (t=0x7edd7cf6b150, u=<optimized out>, e=0x7edddffdb870, R=<optimized out>, param=0) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/subtype.c:801
#16 0x00007ffff7363dfc in exists_subtype (param=0, se=0x7edddffdb7f0, saved=0x7fffe8acc350 <jl_system_image_data+84337424>, e=0x7edddffdb870, y=0x7fffe84226b0 <jl_system_image_data+77350512>, x=0x7edd7cf6b150) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/subtype.c:1464
#17 _forall_exists_subtype (x=x@entry=0x7edd7cf6b150, y=y@entry=0x7fffe84226b0 <jl_system_image_data+77350512>, e=e@entry=0x7edddffdb870, param=param@entry=0, count=count@entry=0x0, noRmore=noRmore@entry=0x0) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/subtype.c:1496
#18 0x00007ffff73640bc in forall_exists_subtype (param=0, e=0x7edddffdb870, y=0x7fffe84226b0 <jl_system_image_data+77350512>, x=0x7edd7cf6b150) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/subtype.c:1512
#19 ijl_subtype_env (x=0x7edd7cf6b150, y=0x7fffe84226b0 <jl_system_image_data+77350512>, env=0x7edddffdbc20, envsz=2) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/subtype.c:1960
#20 0x00007ffff736ca5a in jl_type_intersection_env_s (a=0x7edd7cf6b150, b=0x7fffe84226b0 <jl_system_image_data+77350512>, penv=0x7edddffdc3c0, issubty=issubty@entry=0x7edddffdc3c8) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/subtype.c:3552
#21 0x00007ffff72fa6f4 in jl_typemap_intersection_node_visitor (ml=0x7fffe84224e0 <jl_system_image_data+77350048>, closure=0x7edddffdc3a0) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/typemap.c:457
#22 0x00007ffff72fc681 in jl_typemap_intersection_visitor (map=<optimized out>, offs=offs@entry=3, closure=closure@entry=0x7edddffdc3a0) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/typemap.c:624
#23 0x00007ffff72fc578 in jl_typemap_intersection_visitor (map=<optimized out>, offs=offs@entry=2, closure=closure@entry=0x7edddffdc3a0) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/typemap.c:601
#24 0x00007ffff72fc491 in jl_typemap_intersection_visitor (map=<optimized out>, offs=offs@entry=1, closure=closure@entry=0x7edddffdc3a0) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/typemap.c:545
#25 0x00007ffff72fc638 in jl_typemap_intersection_visitor (map=<optimized out>, offs=offs@entry=0, closure=closure@entry=0x7edddffdc3a0) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/typemap.c:569
#26 0x00007ffff72f2b73 in ml_matches (mt=mt@entry=0x7fffe80a0890 <jl_system_image_data+73672784>, type=type@entry=0x7edd7cf6b150, lim=lim@entry=3, include_ambiguous=include_ambiguous@entry=0, intersections=intersections@entry=1, world=world@entry=33674, cache_result=1, min_valid=0x7edddffdc560, max_valid=0x7edddffdc550, ambig=0x7edddffdc538) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/gf.c:3253
#27 0x00007ffff72f5c10 in ijl_matching_methods (types=0x7edd7cf6b150, mt=0x7fffe80a0890 <jl_system_image_data+73672784>, lim=3, include_ambiguous=0, world=33674, min_valid=0x7edddffdc560, max_valid=0x7edddffdc550, ambig=0x7edddffdc538) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/gf.c:2153
#28 0x00007fffe2e36071 in _methods_by_ftype () at reflection.jl:952
#29 _findall () at compiler/methodtable.jl:107
#30 #findall#275 () at compiler/methodtable.jl:76
#31 findall () at compiler/methodtable.jl:75
#32 julia_#findall#277_15416 () at compiler/methodtable.jl:123
#33 0x00007fffe34c1537 in findall () at compiler/methodtable.jl:114
#34 julia_find_matching_methods_15232 () at compiler/abstractinterpretation.jl:336
#35 0x00007fffe36156cc in julia_abstract_call_gf_by_type_15624 () at compiler/abstractinterpretation.jl:80
#36 0x00007fffe30fa79c in julia_abstract_call_known_13359 () at compiler/abstractinterpretation.jl:1949
#37 0x00007fffe34ab38a in julia_abstract_call_20826 () at compiler/abstractinterpretation.jl:2020
#38 0x00007fffe3681b67 in julia_abstract_call_20851 () at compiler/abstractinterpretation.jl:1999
#39 0x00007fffe351d6c8 in julia_abstract_eval_statement_expr_16795 () at compiler/abstractinterpretation.jl:2183
#40 0x00007fffe2db9de7 in julia_abstract_eval_statement_16850 () at compiler/abstractinterpretation.jl:2396
#41 0x00007fffe2e55a57 in julia_abstract_eval_basic_statement_16369 () at compiler/abstractinterpretation.jl:2684
#42 0x00007fffe348bbe3 in julia_typeinf_local_13272 () at compiler/abstractinterpretation.jl:2869
#43 0x00007fffe34cf64e in julia_typeinf_nocycle_14569 () at compiler/abstractinterpretation.jl:2957
[...]
#80 0x00007fffe2e55a57 in julia_abstract_eval_basic_statement_16369 () at compiler/abstractinterpretation.jl:2684
#81 0x00007fffe348bbe3 in julia_typeinf_local_13272 () at compiler/abstractinterpretation.jl:2869
#82 0x00007fffe34cf64e in julia_typeinf_nocycle_14569 () at compiler/abstractinterpretation.jl:2957
#83 0x00007fffe3533779 in julia__typeinf_19059 () at compiler/typeinfer.jl:244
#84 0x00007fffe367989c in julia_typeinf_14126 () at compiler/typeinfer.jl:215
#85 0x00007fffe350e087 in julia_typeinf_edge_19467 () at compiler/typeinfer.jl:931
[...]
#202 ijl_apply_generic (F=<optimized out>, args=0x7edddfff1998, nargs=<optimized out>) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/gf.c:2940
#203 0x00007ede0765ba2e in ?? ()
#204 0x00007edddfff19f0 in ?? ()
#205 0x0000000000000190 in ?? ()

And at the same time, Thread 1 was stuck waiting on the codegen lock (not sure if relevant, but sharing just in case):

Thread 1 (Thread 0x7ffff7da5cc0 (LWP 6754) "julia"):
#0  _jl_mutex_wait (self=self@entry=0x7ede136ee590, lock=lock@entry=0x7ffff74ef7e0 <jl_codegen_lock>, safepoint=safepoint@entry=1) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/threading.c:720
#1  0x00007ffff73432c0 in _jl_mutex_lock (self=self@entry=0x7ede136ee590, lock=0x7ffff74ef7e0 <jl_codegen_lock>) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/threading.c:748
#2  0x00007ffff22824db in jl_mutex_lock (lock=<optimized out>) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/julia_locks.h:66
#3  jl_generate_fptr_impl (mi=0x7fffa78031c0, world=33674) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/jitlayers.cpp:424
#4  0x00007ffff72f62ba in jl_compile_method_internal (world=33674, mi=<optimized out>) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/gf.c:2348
#5  jl_compile_method_internal (mi=<optimized out>, world=33674) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/gf.c:2237
#6  0x00007ffff72f7146 in _jl_invoke (world=33674, mfunc=0x7fffa78031c0, nargs=2, args=0x7ede15f9e468, F=0x7fffe707bf60 <jl_system_image_data+56745760>) at /tmp/nix-build-julia-1.9.0-rc2-patched.drv-0/source/src/gf.c:2750

We'll keep you updated about whether this reproduces or not.

@NHDaly NHDaly added regression Regression in behavior compared to a previous version types and dispatch Types, subtyping and method dispatch compiler:codegen Generation of LLVM IR and native code labels Apr 11, 2023
@NHDaly
Copy link
Member Author

NHDaly commented May 17, 2023

Closing as duplicate of #49857.

@NHDaly NHDaly closed this as completed May 17, 2023
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 regression Regression in behavior compared to a previous version types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

No branches or pull requests

1 participant