Skip to content

Commit 37e8558

Browse files
Fix some JET errors around matching methods for kill(...) and process_exited(...) (#172)
* Fix some JET errors around matching methods for `kill(...)` and `process_exited(...)` ``` │┌ manage(manager::Distributed.LocalManager, id::Int64, config::Distributed.WorkerConfig, op::Symbol) @ Distributed /workpath/Distributed.jl/src/managers.jl:529 ││ no matching method found `kill(::Nothing, ::Int64)` (1/2 union split): Distributed.kill((config::Distributed.WorkerConfig).process::Union{Nothing, Base.Process}, 2) │└──────────────────── ``` ``` │┌ (::Distributed.var"#200#201"{Int64, Int64, Int64, Int64, Distributed.WorkerConfig})() @ Distributed /workpath/Distributed.jl/src/managers.jl:757 │ no matching method found `kill(::Nothing, ::Int64)` (1/2 union split): Distributed.kill((getfield(#self#::Distributed.var"#200#201"{Int64, Int64, Int64, Int64, Distributed.WorkerConfig}, :config)::Distributed.WorkerConfig).process::Union{Nothing, Base.Process}, (profile_sig::Tuple{String, Int64})[2]::Int64) └──────────────────── ``` ``` ┌ (::Distributed.var"#200#201"{Int64, Int64, Int64, Int64, Distributed.WorkerConfig})() @ Distributed /workpath/Distributed.jl/src/managers.jl:761 │ no matching method found `kill(::Nothing, ::Int64)` (1/2 union split): Distributed.kill((getfield(#self#::Distributed.var"#200#201"{Int64, Int64, Int64, Int64, Distributed.WorkerConfig}, :config)::Distributed.WorkerConfig).process::Union{Nothing, Base.Process}, (Distributed.Base).SIGQUIT::Int64) └──────────────────── ``` ``` ┌ (::Distributed.var"#200#201"{Int64, Int64, Int64, Int64, Distributed.WorkerConfig})() @ Distributed /workpath/Distributed.jl/src/managers.jl:766 │ no matching method found `kill(::Nothing, ::Int64)` (1/2 union split): Distributed.kill((getfield(#self#::Distributed.var"#200#201"{Int64, Int64, Int64, Int64, Distributed.WorkerConfig}, :config)::Distributed.WorkerConfig).process::Union{Nothing, Base.Process}, (Distributed.Base).SIGKILL::Int64) └──────────────────── ``` ``` ┌ (::Distributed.var"#200#201"{Int64, Int64, Int64, Int64, Distributed.WorkerConfig})() @ Distributed /workpath/Distributed.jl/src/managers.jl:752 │ no matching method found `process_exited(::Nothing)` (1/2 union split): Distributed.process_exited((getfield(#self#::Distributed.var"#200#201"{Int64, Int64, Int64, Int64, Distributed.WorkerConfig}, :config)::Distributed.WorkerConfig).process::Union{Nothing, Base.Process}) └──────────────────── ``` ``` ┌ (::Distributed.var"#200#201"{Int64, Int64, Int64, Int64, Distributed.WorkerConfig})() @ Distributed /workpath/Distributed.jl/src/managers.jl:764 │ no matching method found `process_exited(::Nothing)` (1/2 union split): Distributed.process_exited((getfield(#self#::Distributed.var"#200#201"{Int64, Int64, Int64, Int64, Distributed.WorkerConfig}, :config)::Distributed.WorkerConfig).process::Union{Nothing, Base.Process}) └──────────────────── ``` (cherry picked from commit e19a4bfe30fd580cc8e8baa5033e2d7a2c1e1dc9) * Apply suggestions from code review Co-authored-by: James Wrigley <JamesWrigley@users.noreply.github.com> * Define `process = config.process::Process` in one place, and then re-use the `process` variable when needed --------- Co-authored-by: James Wrigley <JamesWrigley@users.noreply.github.com> (cherry picked from commit 231da28ef52953b68280a295419b990cb5c7e3f7)
1 parent 840e489 commit 37e8558

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/managers.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ end
553553

554554
function manage(manager::LocalManager, id::Integer, config::WorkerConfig, op::Symbol)
555555
if op === :interrupt
556-
kill(config.process, 2)
556+
kill(config.process::Process, 2)
557557
end
558558
end
559559

@@ -776,21 +776,22 @@ function kill(manager::LocalManager, pid::Int, config::WorkerConfig; profile_wai
776776
sleep(exit_timeout)
777777

778778
# Check to see if our child exited, and if not, send an actual kill signal
779-
if !process_exited(config.process)
779+
process = config.process::Process
780+
if !process_exited(process)
780781
@warn "Failed to gracefully kill worker $(pid)"
781782
profile_sig = Sys.iswindows() ? nothing : Sys.isbsd() ? ("SIGINFO", 29) : ("SIGUSR1" , 10)
782783
if profile_sig !== nothing
783784
@warn("Sending profile $(profile_sig[1]) to worker $(pid)")
784-
kill(config.process, profile_sig[2])
785+
kill(process, profile_sig[2])
785786
sleep(profile_wait)
786787
end
787788
@warn("Sending SIGQUIT to worker $(pid)")
788-
kill(config.process, Base.SIGQUIT)
789+
kill(process, Base.SIGQUIT)
789790

790791
sleep(term_timeout)
791-
if !process_exited(config.process)
792+
if !process_exited(process)
792793
@warn("Worker $(pid) ignored SIGQUIT, sending SIGKILL")
793-
kill(config.process, Base.SIGKILL)
794+
kill(process, Base.SIGKILL)
794795
end
795796
end
796797
end

0 commit comments

Comments
 (0)