mirror of
https://github.com/PegaProx/project-pegaprox.git
synced 2026-04-25 10:05:56 +03:00
[PR #60] fix(sessions): prevent RuntimeError in cleanup_expired_sessions under concurrency #97
Labels
No labels
Approved
Q2-3 2026 Development
bug
documentation
enhancement
help wanted
invalid
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/project-pegaprox-PegaProx#97
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/PegaProx/project-pegaprox/pull/60
Author: @ry-ops
Created: 2/21/2026
Status: 🔄 Open
Base:
main← Head:fix/session-cleanup-race-condition📝 Commits (1)
ecfc9d1fix(sessions): prevent RuntimeError in cleanup_expired_sessions under concurrency📊 Changes
1 file changed (+13 additions, -4 deletions)
View changed files
📝
pegaprox_multi_cluster.py(+13 -4)📄 Description
Summary
Under concurrent load a request handler thread can add or remove an entry from
active_sessionswhilecleanup_expired_sessionsis iterating over it, causing:Additionally, if a session was already deleted by another thread between the list comprehension and the
delcall, aKeyErrorwould be raised.Changes:
active_sessions.items()into alist()before filtering — iteration is over an immutable copydel active_sessions[sid]withactive_sessions.pop(sid, None)— silently skips sessions already removed by another thread.get('last_activity', 0)as a safe fallback in the expiry filterTest plan
RuntimeError: dictionary changed size during iterationappears in logs🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.