Nheko-Reborn / mtxclient

Client API library for Matrix, built on top of libcurl
MIT License
40 stars 25 forks source link

Sync is broken and always use the same token #9

Closed maxidorius closed 3 years ago

maxidorius commented 5 years ago

When using nheko-reborn with Gridepo over the C2S API r0.4.0, sync doesn't work as expected from an empty state and after creating a new room.

Steps to reproduce (Recording available here):

  1. Start the client with no prior session
  2. Login on the gridepo server
  3. Create a new room

Expected result: See the room appear and be able to use it Experienced behaviour: Creating the room seems to work, including the notification of the room ID being created, but the room never show up.

Here are the requests made by the client and the answers.

{ "next_batch": "0", "rooms": { "invite": {}, "join": {}, "leave": {} } }

After creating the room:

GET /_matrix/client/r0/sync?since=0

{ "next_batch": "1", "rooms": { "invite": {}, "join": { "!AAAAAWjvv73vv71ONTg:gridepo.localhost": { "state": { "events": [] }, "timeline": { "events": [ { "event_id": "$e21bfa442ad24a3297dd05a99bdc4c112DKE:gridepo.localhost", "type": "m.room.create", "origin_server_ts": 1552347320538, "channel_id": "#AAAAAWjvv73vv71ONThAZGFyay5sb2NhbC5tYXguZG9yaXVzLmlv", "room_id": "!AAAAAWjvv73vv71ONTg:gridepo.localhost", "sender": "@user1:gridepo.localhost", "state_key": "", "content": { "creator": "@user1:gridepo.localhost" } } ] }, "invite_state": { "events": [] } } }, "leave": {} } }

All subsequent sync requests:

GET /_matrix/client/r0/sync?since=0

{ "next_batch": "3", "rooms": { "invite": {}, "join": { "!AAAAAWjvv73vv71ONTg:gridepo.localhost": { "state": { "events": [ { "event_id": "$e21bfa442ad24a3297dd05a99bdc4c112DKE:gridepo.localhost", "type": "m.room.create", "origin_server_ts": 1552347320538, "channel_id": "#AAAAAWjvv73vv71ONThAZGFyay5sb2NhbC5tYXguZG9yaXVzLmlv", "room_id": "!AAAAAWjvv73vv71ONTg:gridepo.localhost", "sender": "@user1:gridepo.localhost", "state_key": "", "content": { "creator": "@user1:gridepo.localhost" } } ] }, "timeline": { "events": [ { "event_id": "$68be95fd308241baa2692cecb72de6722Lf9:gridepo.localhost", "type": "m.room.member", "origin_server_ts": 1552347320558, "channel_id": "#AAAAAWjvv73vv71ONThAZGFyay5sb2NhbC5tYXguZG9yaXVzLmlv", "room_id": "!AAAAAWjvv73vv71ONTg:gridepo.localhost", "sender": "@user1:gridepo.localhost", "state_key": "@user1:gridepo.localhost", "content": { "action": "join", "membership": "join" } }, { "event_id": "$0b21c32750de4fe99fa939b549d813e7yaR1:gridepo.localhost", "type": "m.room.power_levels", "origin_server_ts": 1552347320566, "channel_id": "#AAAAAWjvv73vv71ONThAZGFyay5sb2NhbC5tYXguZG9yaXVzLmlv", "room_id": "!AAAAAWjvv73vv71ONTg:gridepo.localhost", "sender": "@user1:gridepo.localhost", "state_key": "", "content": { "ban": 50.0, "invite": 0.0, "kick": 50.0, "state_default": 50.0, "events_default": 0.0, "users_default": 0.0, "users": { "@user1:gridepo.localhost": 1000.0 } } } ] }, "invite_state": { "events": [] } } }, "leave": {} } }


What I notice is that the very first sync `next_token` is used in all next requests, while any of the others `next_token` are not being used, requesting the same data over and over again without actually being able to process it it seems.

This is all the console output:

$ ./nheko-6f13b0d-x86_64.AppImage [2019-03-12 02:00:18.166] [ui] [info] jdenticon plugin not found. [2019-03-12 02:00:18.211] [ui] [info] starting nheko 0.6.3-6f13b0d [2019-03-12 02:00:34.385] [db] [info] initializing LMDB [2019-03-12 02:00:34.394] [crypto] [info] creating new olm account [2019-03-12 02:00:34.397] [crypto] [info] ed25519 : X5QRpwlQisGju5EmlrVm6oL/hMBVNgyRRCHjvGC1dbE [2019-03-12 02:00:34.398] [crypto] [info] curve25519: j5e7nLR0fopAKPxo3sF5vYGYFOXydde3jQYzxANnQg0 [2019-03-12 02:00:34.398] [crypto] [info] generating one time keys [2019-03-12 02:00:34.437] [net] [warning] skipping key uploading. server doesn't provide /keys/upload [2019-03-12 02:00:34.437] [net] [info] trying initial sync [2019-03-12 02:00:34.440] [net] [critical] failed to retrieve joined groups: -134099632 [2019-03-12 02:00:34.456] [net] [info] initial sync completed [2019-03-12 02:00:34.457] [ui] [info] initialize room list


Restarting the client, using the cache, also doesn't help:

$ Downloads/nheko-6f13b0d-x86_64.AppImage [2019-03-12 01:51:51.117] [db] [info] restoring state from cache [2019-03-12 01:51:51.120] [ui] [info] jdenticon plugin not found. [2019-03-12 01:51:51.133] [net] [critical] failed to retrieve joined groups: 268517296 [2019-03-12 01:51:51.143] [db] [info] sessions restored [2019-03-12 01:51:51.148] [db] [info] loading 0 rooms [2019-03-12 01:51:51.149] [crypto] [info] ed25519 : MfYFoGHQvtixoE7pOSrrpmuqj7J4NjG+7XV6QX4kKDI [2019-03-12 01:51:51.149] [crypto] [info] curve25519: RhTecg4Psr8gG2RXRVjavwXNZ9to3FfCCEF50IMWMVU [2019-03-12 01:51:51.184] [ui] [info] starting nheko 0.6.3-6f13b0d [2019-03-12 01:51:51.184] [ui] [info] initialize room list



It feels like there is an error processing the sync payload which is not logged or displayed, making the client loop forever.
deepbluev7 commented 3 years ago

This is maybe fixed now. At least we log failed syncs now, although we still loop on parse errors.