From a6e615bed71e3329299e55930f8bd40943e54c98 Mon Sep 17 00:00:00 2001 From: Dilum Aluthge Date: Fri, 20 Feb 2026 23:37:39 -0500 Subject: [PATCH] Fix JET errors around matching methods for `lock(...)` and `unlock(...)` (#167) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a forward-port of https://github.com/JuliaLang/Distributed.jl/pull/167 (https://github.com/JuliaLang/Distributed.jl/commit/9f6459f83f08e2ef147d102afc1ea5d6d8ab1ec1). ``` ┌ put_ref(rid::Distributed.RRID, caller::Int64, args::WeakRef) @ Distributed /workpath/Distributed.jl/src/remotecall.jl:709 │ no matching method found `lock(::Nothing)` (1/2 union split): Distributed.lock((rv::Distributed.RemoteValue).synctake::Union{Nothing, ReentrantLock}) └──────────────────── ``` ``` ┌ put_ref(rid::Distributed.RRID, caller::Int64, args::WeakRef) @ Distributed /workpath/Distributed.jl/src/remotecall.jl:710 │ no matching method found `unlock(::Nothing)` (1/2 union split): Distributed.unlock((rv::Distributed.RemoteValue).synctake::Union{Nothing, ReentrantLock}) ││││││││││││││└──────────────────── ``` ``` ┌ take_ref(rid::Any, caller::Any, args::Vararg{Any}) @ Distributed /workpath/Distributed.jl/src/remotecall.jl:734 │ no matching method found `lock(::Nothing)` (1/2 union split): Distributed.lock((rv::Distributed.RemoteValue).synctake::Union{Nothing, ReentrantLock}) └──────────────────── ``` ``` ┌ take_ref(rid::Any, caller::Any, args::Vararg{Any}) @ Distributed /workpath/Distributed.jl/src/remotecall.jl:742 │ no matching method found `unlock(::Nothing)` (1/2 union split): Distributed.unlock((rv::Distributed.RemoteValue).synctake::Union{Nothing, ReentrantLock}) └──────────────────── ``` ``` ┌ (::Distributed.var"#handle_msg##2#handle_msg##3"{Distributed.CallMsg{…}, Distributed.MsgHeader, Base.PipeEndpoint})() @ Distributed /workpath/Distributed.jl/src/process_messages.jl:292 │ no matching method found `unlock(::Nothing)` (1/2 union split): Distributed.unlock(((v::Distributed.SyncTake).rv::Distributed.RemoteValue).synctake::Union{Nothing, ReentrantLock}) └──────────────────── ``` (cherry picked from commit 01027d14d994da11b8962d9a20a2f5a6888dec5f) (cherry picked from commit 9f6459f83f08e2ef147d102afc1ea5d6d8ab1ec1) --- src/process_messages.jl | 2 +- src/remotecall.jl | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/process_messages.jl b/src/process_messages.jl index a444651..504a19e 100644 --- a/src/process_messages.jl +++ b/src/process_messages.jl @@ -289,7 +289,7 @@ function handle_msg(msg::CallMsg{:call_fetch}, header, r_stream, w_stream, versi try deliver_result(w_stream, :call_fetch, header.notify_oid, v.v) finally - unlock(v.rv.synctake) + unlock(v.rv.synctake::ReentrantLock) end else deliver_result(w_stream, :call_fetch, header.notify_oid, v) diff --git a/src/remotecall.jl b/src/remotecall.jl index 644ff04..d0ac719 100644 --- a/src/remotecall.jl +++ b/src/remotecall.jl @@ -706,8 +706,8 @@ function put_ref(rid, caller, args...) put!(rv, args...) if myid() == caller && rv.synctake !== nothing # Wait till a "taken" value is serialized out - github issue #29932 - lock(rv.synctake) - unlock(rv.synctake) + lock(rv.synctake::ReentrantLock) + unlock(rv.synctake::ReentrantLock) end nothing end @@ -731,7 +731,7 @@ function take_ref(rid, caller, args...) # special handling for local put! / remote take! on unbuffered channel # github issue #29932 synctake = true - lock(rv.synctake) + lock(rv.synctake::ReentrantLock) end v = try @@ -739,7 +739,7 @@ function take_ref(rid, caller, args...) catch e # avoid unmatched unlock when exception occurs # github issue #33972 - synctake && unlock(rv.synctake) + synctake && unlock(rv.synctake::ReentrantLock) rethrow(e) end