From b414fb4b1b81e016da6d491e548a43ce84c1b60b Mon Sep 17 00:00:00 2001 From: Ian Date: Wed, 21 Jun 2023 23:21:00 +0100 Subject: [PATCH 1/2] increase stale age to 5 mins --- base/loading.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base/loading.jl b/base/loading.jl index 56c40af68479f..c2b59019cc5c5 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -2832,8 +2832,8 @@ compilecache_pidfile_path(pkg::PkgId) = compilecache_path(pkg, UInt64(0)) * ".pi # The lock file is deleted and precompilation will proceed after `stale_age` seconds if # - the locking process no longer exists # - the lock is held by another host, since processes cannot be checked remotely -# or after `stale_age * 25` seconds if it does still exist. -function maybe_cachefile_lock(f, pkg::PkgId, srcpath::String; stale_age=60) +# or after `stale_age * 25` seconds if the process does still exist. +function maybe_cachefile_lock(f, pkg::PkgId, srcpath::String; stale_age=300) if @isdefined(mkpidlock_hook) && @isdefined(trymkpidlock_hook) && @isdefined(parse_pidfile_hook) pidfile = compilecache_pidfile_path(pkg) cachefile = invokelatest(trymkpidlock_hook, f, pidfile; stale_age) From 2dd0bc0905d65bfa18cc030955a7dd84032f5b38 Mon Sep 17 00:00:00 2001 From: Ian Date: Wed, 21 Jun 2023 23:24:22 +0100 Subject: [PATCH 2/2] remove dependence of pidfile hash on active project --- base/loading.jl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/base/loading.jl b/base/loading.jl index c2b59019cc5c5..92af6de7c5beb 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -2226,14 +2226,14 @@ function compilecache_dir(pkg::PkgId) return joinpath(DEPOT_PATH[1], entrypath) end -function compilecache_path(pkg::PkgId, prefs_hash::UInt64)::String +function compilecache_path(pkg::PkgId, prefs_hash::UInt64; project::String=something(Base.active_project(), ""))::String entrypath, entryfile = cache_file_entry(pkg) cachepath = joinpath(DEPOT_PATH[1], entrypath) isdir(cachepath) || mkpath(cachepath) if pkg.uuid === nothing abspath(cachepath, entryfile) * ".ji" else - crc = _crc32c(something(Base.active_project(), "")) + crc = _crc32c(project) crc = _crc32c(unsafe_string(JLOptions().image_file), crc) crc = _crc32c(unsafe_string(JLOptions().julia_bin), crc) crc = _crc32c(ccall(:jl_cache_flags, UInt8, ()), crc) @@ -2823,10 +2823,10 @@ global mkpidlock_hook global trymkpidlock_hook global parse_pidfile_hook -# The preferences hash is only known after precompilation so just assume no preferences -# meaning that if all other conditions are equal, the same package cannot be precompiled -# with different preferences at the same time. -compilecache_pidfile_path(pkg::PkgId) = compilecache_path(pkg, UInt64(0)) * ".pidfile" +# The preferences hash is only known after precompilation so just assume no preferences. +# Also ignore the active project, which means that if all other conditions are equal, +# the same package cannot be precompiled from different projects and/or different preferences at the same time. +compilecache_pidfile_path(pkg::PkgId) = compilecache_path(pkg, UInt64(0); project="") * ".pidfile" # Allows processes to wait if another process is precompiling a given source already. # The lock file is deleted and precompilation will proceed after `stale_age` seconds if