@@ -1954,7 +1954,7 @@ function _require(pkg::PkgId, env=nothing)
19541954 pkg_precompile_attempted = true
19551955 unlock (require_lock)
19561956 try
1957- PKG_PRECOMPILE_HOOK[](pkg. name, _from_loading = true )
1957+ @invokelatest PKG_PRECOMPILE_HOOK[](pkg. name, _from_loading = true )
19581958 finally
19591959 lock (require_lock)
19601960 end
@@ -2398,12 +2398,6 @@ function compilecache(pkg::PkgId, path::String, internal_stderr::IO = stderr, in
23982398
23992399 # inherit permission from the source file (and make them writable)
24002400 chmod (tmppath, filemode (path) & 0o777 | 0o200 )
2401- if cache_objects
2402- # Ensure that the user can execute the `.so` we're generating
2403- # Note that on windows, `filemode(path)` typically returns `0o666`, so this
2404- # addition of the execute bit for the user is doubly needed.
2405- chmod (tmppath_so, filemode (path) & 0o777 | 0o333 )
2406- end
24072401
24082402 # prune the directory with cache files
24092403 if pkg. uuid != = nothing
@@ -2967,24 +2961,27 @@ global parse_pidfile_hook
29672961# the same package cannot be precompiled from different projects and/or different preferences at the same time.
29682962compilecache_pidfile_path (pkg:: PkgId ) = compilecache_path (pkg, UInt64 (0 ); project= " " ) * " .pidfile"
29692963
2964+ const compilecache_pidlock_stale_age = 10
2965+
29702966# Allows processes to wait if another process is precompiling a given source already.
2971- # The lock file mtime will be updated when held every `stale_age/2` seconds.
2967+ # The lock file mtime will be updated when held at most every `stale_age/2` seconds, with expected
2968+ # variance of 10 seconds or more being infrequent but not unusual.
29722969# After `stale_age` seconds beyond the mtime of the lock file, the lock file is deleted and
2973- # precompilation will proceed if
2974- # - the locking process no longer exists
2975- # - the lock is held by another host, since processes cannot be checked remotely
2976- # or after `stale_age * 25` seconds if the process does still exist.
2977- function maybe_cachefile_lock (f, pkg:: PkgId , srcpath:: String ; stale_age= 10 )
2970+ # precompilation will proceed if the locking process no longer exists or after `stale_age * 5`
2971+ # seconds if the process does still exist.
2972+ # If the lock is held by another host, it will conservatively wait `stale_age * 5`
2973+ # seconds since processes cannot be checked remotely
2974+ function maybe_cachefile_lock (f, pkg:: PkgId , srcpath:: String ; stale_age= compilecache_pidlock_stale_age )
29782975 if @isdefined (mkpidlock_hook) && @isdefined (trymkpidlock_hook) && @isdefined (parse_pidfile_hook)
29792976 pidfile = compilecache_pidfile_path (pkg)
29802977 cachefile = invokelatest (trymkpidlock_hook, f, pidfile; stale_age)
29812978 if cachefile === false
29822979 pid, hostname, age = invokelatest (parse_pidfile_hook, pidfile)
29832980 verbosity = isinteractive () ? CoreLogging. Info : CoreLogging. Debug
29842981 if isempty (hostname) || hostname == gethostname ()
2985- @logmsg verbosity " Waiting for another process (pid: $pid ) to finish precompiling $pkg "
2982+ @logmsg verbosity " Waiting for another process (pid: $pid ) to finish precompiling $pkg . Pidfile: $pidfile "
29862983 else
2987- @logmsg verbosity " Waiting for another machine (hostname: $hostname , pid: $pid ) to finish precompiling $pkg "
2984+ @logmsg verbosity " Waiting for another machine (hostname: $hostname , pid: $pid ) to finish precompiling $pkg . Pidfile: $pidfile "
29882985 end
29892986 # wait until the lock is available, but don't actually acquire it
29902987 # returning nothing indicates a process waited for another
0 commit comments