You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
InMemorySessionService keeps empty user maps after sessions are deleted #7722
InMemorySessionService.delete_session removes the session itself but leaves the empty per-user dictionary in service.sessions. Once all users are empty, the app dictionary is left behind too.
Repeated create/delete cycles with new user IDs therefore keep growing the internal structure even though there are no live sessions.
Steps to Reproduce:
Create an InMemorySessionService.
Create and delete one session for each of 10,000 distinct users.
Inspect service.sessions.
Expected Behavior:
Deleting a user's last session should remove that user's empty session dictionary. If it was the app's last user, the empty app dictionary should be removed as well.
Observed Behavior:
All 10,000 empty user dictionaries remain reachable:
apps: 1
retained users: 10000
live sessions: 0
Environment Details:
ADK Library Version: current main at da35ca77d71f7d74c8b7d7550f6e1b591a6690e0
Desktop OS: Ubuntu 24.04.4 LTS
Python Version: 3.14.4
Model Information:
Are you using LiteLLM: No
Which model is being used: N/A
🟡 Optional Information
Regression:
Unknown.
Logs:
I also added a focused test that expected the empty app entry to be removed after deleting its only session. It fails on current main with:
AssertionError: assert 'my_app' not in {'my_app': {'user': {}}}
Screenshots / Video:
N/A
Additional Context:
The cleanup can stay local to _delete_session_impl: remove the session, then remove the user entry if its dictionary is empty, followed by the app entry if that dictionary is empty. User- and app-scoped state are stored separately, so this would only prune the session index.
Activity
delete_session removed the session but kept the per-user and per-app …
delete_session removed the session but kept the per-user and per-app …