julia icon indicating copy to clipboard operation
julia copied to clipboard

OrcJIT InPlaceTaskDispatcher excessive recursion now causes crashes

Open fonsp opened this issue 7 months ago • 5 comments

To reproduce:

  1. Delete the .julia/compiled/v1.12 folder
  2. Start Julia with:
julia +1.12 --inline=no
  1. Type ] to enter the Pkg REPL

This will leave Julia stuck in this state:

Image

This essentially makes --inline=no unusable.

fonsp avatar Apr 25 '25 13:04 fonsp

It is also not possible to interrupt precompilation with Ctrl+C:

Image

fonsp avatar Apr 25 '25 13:04 fonsp

Running Julia in non-interactive mode shows one additional error stack overflow message:

➜  Documents julia +1.12 --inline=no -e "import Pkg"
Info Given Pkg was explicitly requested, output will be shown live 
Warning: detected a stack overflow; program state may be corrupted, so further execution might be unreliable.
Precompiling packages  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━ 24/25
  ◑ Pkg

fonsp avatar Apr 25 '25 14:04 fonsp

In case it's not clear, I'll just note that this is not necessarily a bug. Disabling inlining will cause stack overflows, among other issues, for some code.

nsajko avatar Apr 27 '25 09:04 nsajko

I my view: --inline=no is public API, and being able to import Pkg is public API, so their combination should work, just like in Julia 1.11.

If we are dropping support for Pkg with --inline=no starting with Julia 1.12, then that should be documented.

fonsp avatar Apr 28 '25 07:04 fonsp

This looks like a known problem with the OrcJIT's default InPlaceTaskDispatcher since I'm told that is a legacy component to support MCJIT and not used in production. I've talked with Lang about it, and we need to switch to DynamicThreadPoolTaskDispatcher, so that it uses extra threads instead of extra stack frames, to link the code successfully.

Duplicate of https://github.com/JuliaLang/julia/issues/57149.

vtjnash avatar May 13 '25 20:05 vtjnash

Oh oops, I forgot to change the text in the pr so it auto closed. The pr only mitigates this slightly

gbaraldi avatar Jun 17 '25 16:06 gbaraldi

I don't think this really has to be on the milestone

KristofferC avatar Jul 03 '25 19:07 KristofferC

I have a fix for this locally. I was waiting to see if upstream would take the fix soon, but they currently seem reluctant to accept a fix for this, so I'll just make a local PR soon

vtjnash avatar Jul 04 '25 01:07 vtjnash