matrix-org / dendrite

Dendrite is a second-generation Matrix homeserver written in Go!
https://matrix-org.github.io/dendrite/
Apache License 2.0
5.75k stars 676 forks source link

Device keys get marked out of date every second sync #1625

Closed deepbluev7 closed 3 years ago

deepbluev7 commented 3 years ago

Background information

Description

After logging in with Nheko on dendrite.matrix.org, I get the following update in every second sync, causing my client to mark those users keys as out of date:

    "device_lists": {
        "changed": [
            "@jonah:aragon.sh",
            "@neilalexander:dendrite.matrix.org",
            "@florian:wolkenplanet.de",
            "@ninchuka:matrix.org",
            "@kim:sosnowkadub.de",
            "@midov:midov.pl",
            "@mathijs:dendrite.matrix.org",
            "@kegan:dendrite.kegsay.com",
            "@alexander:eiselecloud.de",
            "@deepbluev7:dendrite.matrix.org",
            "@neilalexander:dendrite.neilalexander.dev",
            "@office:ddt-consult.de",
            "@jaywink:federator.dev",
            "@mewmew:blob.cat",
            "@midek:construct.midov.moe",
            "@schwukas:lkas.cc",
            "@ruff_wizard:pixie.town",
            "@travis:dendrite.matrix.org",
            "@tom:lant.uk",
            "@android_ex.ai:midov.pl",
            "@xethos:xethos.net"
        ]
    },

This also includes my own user, @deepbluev7:dendrite.matrix.org, who only has this one device.

I also get 2 times the same sync token, only differing in the last number: s69732_6464.dl-0-9131 and s69737_6464.dl-0-0.

The last number seems to be the same in every second sync. It looks like Nheko is running 2 parallel /sync streams here for some reason, but the sync tokens actually flip flop the last number after each sync, which then causes dendrite to send device_lists for one of those /sync's?

Steps to reproduce

Expected behaviour

Device lists should not change, if they don't actually change.

kegsay commented 3 years ago

Looks like the device list partition/offset is being reset - dl-0-0, which would cause them all to come down as changed.

neilalexander commented 3 years ago

Should be fixed by #1641.