Local names linking fixes#61165
Merged
topolarity merged 6 commits intoJuliaLang:masterfrom Feb 26, 2026
Merged
Conversation
If another thread observes jl_fptr_wait_for_compiled_addr after we've written it to invoke, but before we have put ORC symbols for this CodeInstance in CISymbols, it's possible for the publishCIs call to fail. Avoid this by writing jl_fptr_wait_for_compiled_addr while holding the LinkerMutex (all access to CISymbols is protected by this mutex).
We enter a GC-safe region inside the JuliaTaskDispatcher now, instead.
topolarity
reviewed
Feb 26, 2026
Member
|
Let's merge this to get CI green again 👍 Thanks @xal-0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The merging of #60031 revealed a few remaining multithreading issues with local names linking (https://buildkite.com/julialang/julia-master/builds/55081/steps/canvas?jid=019c9584-a2fa-4ddc-bc7e-95ee729211a0&tab=output).
This PR has a series of commits addressing these issues and making us a little more eager to crash with a useful message in situations that would otherwise result in a deadlock in
JuliaTaskDispatcher:JLMaterializationUnit::materializeafter callingMaterializationResponsibility::failMaterialization.publishCIs, callabort()instead of potentially deadlocking.Two concurrency issues are fixed. The first is that there was a window of time during which a CodeInstance added to the JIT via
jl_emit_codeinst_to_jithadinvoke == jl_fptr_wait_for_compiled_addr, but did not have ORC symbols set up inJuliaOJIT::CISymbols. We solve this by taking the lock before setting up the ORC symbols, skipping any CodeInstances where another thread beat us to the punch in settinginvoke.I suspect the second issue is the one that was causing rare CI failures. We had a data race on the
InFlightcounter forJLJITLinkMemoryManager, which, if decremented below zero, would cause theFinalizedCallbacksto never fire. This manifests as deadlocks inJuliaTaskDispatcher, since those symbols will be stuck in theSymbolState::Resolvedstate forever.