#476 Race Condition: Cache eviction KeyError in activity_worker and config
Description
Editengine/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 AllLoading audit history...