matrix-org / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://matrix-org.github.io/synapse
Apache License 2.0
11.83k stars 2.12k forks source link

`last_seen_ts` in `/client/r0/devices` is out of date #16084

Open weeman1337 opened 1 year ago

weeman1337 commented 1 year ago

Description

When querying the devices list it seems like last_seen_ts is out of date.

Steps to reproduce

I know I have devices, that I recently used. All returned last_seen_ts are out of date.

Homeserver

element.ems.host

Synapse Version

1.89.0

Installation Method

I don't know

Database

-

Workers

I don't know

Platform

-

Configuration

No response

Relevant log output

-

Anything else that would be useful to know?

No response

erikjohnston commented 1 year ago

@sandhose do you think this is because we're running MAS on element.io?

sandhose commented 1 year ago

@sandhose do you think this is because we're running MAS on element.io?

This is definitely the case, we're not recording device activity on Synapse with delegated auth. It's supposed to be a OIDC Provider feature (part of the OP UI to manage sessions), but it's not in MAS yet

reivilibre commented 1 year ago

How often does this happen? Is it wrong every single time you query the device list or are you only noticing it occasionally?

weeman1337 commented 1 year ago

How often does this happen? Is it wrong every single time you query the device list or are you only noticing it occasionally?

Every time. The symptom is, that the last activity in the session list is out of date.

clokep commented 1 year ago

This is definitely the case, we're not recording device activity on Synapse with delegated auth. It's supposed to be a OIDC Provider feature (part of the OP UI to manage sessions), but it's not in MAS yet

@sandhose Does this mean it is working as expected and this is a MAS feature request, not a Synapse bug? (I.e. should we close this?)

DMRobertson commented 12 months ago

I think https://github.com/matrix-org/synapse/pull/16672 means that this should work now. But it's not clear to me if Synapse should be reporting this data rather than MAS. Maybe for delegated auth Synapse should only be writing to monthly_active_users, and not user_ips? @sandhose WDYT?

sandhose commented 12 months ago

I'm OK with restoring this for now, as before it would just result to confusing, incoherent report, as the interface would show times from before the migration.

Maybe it would be worth stripping those informations out from /devices if delegation is enabled?

DMRobertson commented 12 months ago

Thanks Quentin.

Maybe it would be worth stripping those informations out from /devices if delegation is enabled?

Perhaps in the future. (More generally is there a plan to route this endpoint to the auth service?)

My vote would be to wait for #16672 to land (Synapse 1.98) and check this gives sensible last_seen_ts values, and leave everything else to future work.