Skip to content

Resumed sessions cannot be deleted correctly from OnMessageTask destructor #1537

@confluence

Description

@confluence

The session manager attempts to delete sessions using their internal ID. If the session has been resumed, this ID doesn't match the ID that is used as the key in the session map, so deletion fails, and the resumed session remains in the map for the lifetime of the backend:

(...)
[2025-11-26 08:24:25.385Z] [CARTA] [info] (0x55fce67c13b0) Session setting id to 453400019 (was 533405539) on resume
(...)
[2025-11-26 08:24:54.365Z] [CARTA] [info] Session 453400019 [105.28.124.2] Deleted. Remaining sessions: 1
[2025-11-26 08:24:54.365Z] [CARTA] [info] Session 533405539 reference count is not 0 (1) at this point in DeleteSession
[2025-11-26 08:24:54.365Z] [CARTA] [info] (0x55fce67c13b0) Remove Session 453400019 in ~OMT
[2025-11-26 08:24:54.365Z] [CARTA] [warning] Could not delete session 453400019: not found!
(...)
[2025-11-26 08:31:09.459Z] [CARTA] [info] Sessions in Session Map :
[2025-11-26 08:31:09.459Z] [CARTA] [info]   Map id 568217319, session id 568217319, session ptr 0x55fce682d960
[2025-11-26 08:31:09.459Z] [CARTA] [info]   Map id 533405539, session id 453400019, session (...)
[2025-11-26 16:18:02.403Z] [CARTA] [info] Sessions in Session Map :
[2025-11-26 16:18:02.403Z] [CARTA] [info]   Map id 2317353122, session id 2317353122, session ptr 0x55fce68c2da0
[2025-11-26 16:18:02.403Z] [CARTA] [info]   Map id 533405539, session id 453400019, session ptr 0x55fce67c13b0

This has the same root cause as #1417, and can be fixed with the ID lookup map that was added to fix that issue. The session manager should look up the "real" ID of the resumed session to delete it.

While we are looking at this, it may be a good idea to replace our homebrew reference counting code and raw session pointers in the map with shared pointers.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions