sp132
sp1324w ago

Session state is not properly reduced

I've noticed that some terminated sessions still appear in the /v2/sessions response because sessions8 still lists them as active, even though there is a session.terminated event in the event log. There are no related errors/warnings in the log so I'm not sure what's happening. I'm running self-hosted 2.70.14 with PostgreSQL
No description
8 Replies
Rajat
Rajat4w ago
hey @sp132 I think this is related to https://github.com/zitadel/zitadel/issues/10045#issuecomment-3167181873 I can check with marco if this still persists , is it still happening?
GitHub
[Bug]: expired session is not terminated properly · Issue #10045 ...
Preflight Checklist I could not find a solution in the documentation, the existing issues or discussions I have joined the ZITADEL chat Environment Self-hosted Version 2.70.11 Database PostgreSQL D...
xen0byte
xen0byte4w ago
It's a different problem, sadly. The ticket describes a problem with sessions that are already expired, but in this case even session without a TTL still persists in sessions8 projection after termination (even though there is an session_terminated event in the event store)
sp132
sp132OP2w ago
Any pointers?
Rajat
Rajat2w ago
hey @sp132 I will check it today
sp132
sp132OP2w ago
I'm happy to help, let me know if you need additional information
sp132
sp132OP2w ago
Correct me if I'm wrong, but it seems that projections.sessions8 isn’t updated at all after the session is terminated. https://github.com/zitadel/zitadel/blob/v2.70.14/internal/command/session.go#L331-L362 I suppose it relies on some background process then?
GitHub
zitadel/internal/command/session.go at v2.70.14 · zitadel/zitadel
ZITADEL - Identity infrastructure, simplified for you. - zitadel/zitadel
sp132
sp132OP2w ago
It doesn't seem to be a one-off problem either
select p.*
from eventstore.events2 es
join projections.sessions8 p on p.id = es.aggregate_id
where es.aggregate_type = 'session'
and es.event_type = 'session.terminated'
order by p.change_date desc
select p.*
from eventstore.events2 es
join projections.sessions8 p on p.id = es.aggregate_id
where es.aggregate_type = 'session'
and es.event_type = 'session.terminated'
order by p.change_date desc
returns 21 rows ranging from 08/08 to present day. there could've been more if not for the clean up procedure we have in place
Rajat
Rajat2w ago
hey @sp132 can you pls open an issue, I know who can look into it, but they're bust atm. So kindly please open an issue and I will tag the relevent engineer.

Did you find this page helpful?