#476 Race Condition: Cache eviction KeyError in activity_worker and config

closed medium Created 2025-12-17 01:42 · Updated 2025-12-17 01:45

Description

Edit
engine/services/activity_worker.py:105-126 engine/config.py:632-644 Cache eviction can raise KeyError: ```python sorted_keys = sorted(cache.keys(), key=lambda k: cache[k][1]) for key in sorted_keys[:to_remove]: del cache[key] # Key may already be deleted by cleanup ``` Race: _cleanup_expired_* deletes keys, then sorted() accesses deleted keys. FIX: Guard deletion with 'if key in cache' or snapshot keys before sorting.

Comments

Loading comments...

Context

Loading context...

Audit History

View All
Loading audit history...