diff --git a/docs/src/_changelog.md b/docs/src/_changelog.md index 9eec614..1e0e1fd 100644 --- a/docs/src/_changelog.md +++ b/docs/src/_changelog.md @@ -7,6 +7,12 @@ CurrentModule = DistributedNext This documents notable changes in DistributedNext.jl. The format is based on [Keep a Changelog](https://keepachangelog.com). +## Unreleased + +### Fixed +- Backported various fixes from Distributed ([#25]). +- Fixed a lingering task that could cause hangs when exiting Distributed ([#51]). + ## [v1.1.0] - 2025-08-02 ### Fixed diff --git a/src/DistributedNext.jl b/src/DistributedNext.jl index 113679b..cbd16b5 100644 --- a/src/DistributedNext.jl +++ b/src/DistributedNext.jl @@ -132,7 +132,10 @@ include("pmap.jl") include("managers.jl") # LocalManager and SSHManager include("precompile.jl") +_stdlib_watcher_timer::Union{Timer, Nothing} = nothing + function __init__() + global _stdlib_watcher_timer init_parallel() if ccall(:jl_generating_output, Cint, ()) == 0 @@ -141,20 +144,12 @@ function __init__() # cluster cookie has been set, which is most likely to have been done # through Distributed.init_multi() being called by Distributed.addprocs() or # something. - watcher_task = Threads.@spawn while true + _stdlib_watcher_timer = Timer(0; interval=1) do timer if _check_distributed_active() - return - end - - try - sleep(1) - catch - # sleep() may throw when the internal object it waits on is closed - # as the process exits. - return + close(timer) end end - errormonitor(watcher_task) + atexit(() -> close(_stdlib_watcher_timer)) end end diff --git a/test/runtests.jl b/test/runtests.jl index bbc8577..ab596e9 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -10,8 +10,9 @@ include(joinpath(Sys.BINDIR, "..", "share", "julia", "test", "testenv.jl")) cmd = `$test_exename $test_exeflags` -# LibSSH.jl currently only works on unixes -if Sys.isunix() +# LibSSH.jl currently only works on unixes, and the latest release currently +# doesn't pass CI on MacOS. +if Sys.islinux() # Run the SSH tests with a single thread because LibSSH.jl is not thread-safe sshtestfile = joinpath(@__DIR__, "sshmanager.jl") if Base.VERSION >= v"1.12-"