Skip to content

Commit d753f9b

Browse files
nsicchaclaude
andcommitted
fix: disable key tracking (concurrency-unsafe), add TODO for DiskCacheLocks fix
_record_accessed_key is now a no-op to prevent EOFError crashes from concurrent read-modify-write on _keys.sjl files. Added TODO to use DiskCacheLocks for concurrency-safe key tracking. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f8b0554 commit d753f9b

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/DynamicObjects.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ No-op strategy: never records or loads keys. Use when tracking is unwanted.
399399
"""
400400
struct NoKeyTracker <: KeyTracker end
401401

402+
# TODO: use DiskCacheLocks to make _record_key_to_path concurrency-safe
402403
function _record_key_to_path(path, key)
403404
mkpath(dirname(path))
404405
existing = isfile(path) ? Serialization.deserialize(path) : Set()
@@ -476,8 +477,10 @@ function record_access!(ip::IndexableProperty{name}, key) where {name}
476477
end
477478

478479
# Internal: record accessed key from getorcomputeproperty context
480+
# Disabled: key tracking files are not concurrency-safe and cause EOFError crashes
479481
function _record_accessed_key(o, name::Symbol, indices, kwargs)
480-
record!(key_tracker(o, Val(name)), (indices, (;kwargs...)))
482+
# record!(key_tracker(o, Val(name)), (indices, (;kwargs...)))
483+
nothing
481484
end
482485

483486
_computeproperty(o, name, indices...; __status__=nothing, kwargs...) = begin
@@ -496,6 +499,9 @@ If multiple objects with the same hash are writing here concurrently, this may i
496499
disk_locks = _disk_cache(o, vname)
497500
rv = if __strict__ && !isnothing(disk_locks)
498501
path_lock = get_path_lock!(disk_locks, cache_path)
502+
if islocked(path_lock)
503+
@info "Waiting for disk cache lock on $cache_path\n$_cache_context"
504+
end
499505
lock(path_lock) do
500506
cache_status = get_cache_status(cache_path)
501507
rv = if cache_status == :ready

0 commit comments

Comments
 (0)