Comments (7)
Sorry for taking time. Ok, if you want to try this guess out, here's what I would do.
First, enable the E2EE logging category (see the library's README how to do that; you need quotient.e2ee.debug=true
, namely). Reproduce the problem (if Tobias' guess is right, it probably doesn't matter whether the trigger is time or the number of messages, so to save time you can just send 100 messages in an encrypted room). When the Megolm session gets rotated, you will see a message in the logs: "Creating new outbound megolm session". If it doesn't occur and other clients stop being able to decrypt the events - there's a problem even with the session creation; but this is unlikely.
So if that message in the logs shows up - the code that actually sends the new session key is inside Connection::sendSessionKeyToDevices()
(see connection.cpp
) and it's called from Room::Private::doSendEvent()
. Again, you will see in the logs if that actually happens, the message should be "Sending room key to devices", with the new session ID following. If that doesn't happen - you'll have to debug R::P::doSendEvent()
to understand why it doesn't call C::sendSessionKeyToDevices()
.
Now, if that message is also there in the logs, we have to go through sendSessionKeyToDevices()
in order to understand two things: 1) whether it collects the right list of target devices (again, you can see it from the logs but you might even want to break and step over the loop in the beginning of the method); and 2) whether it actually sends the request - this can also be found from the logs (each request is sent within a "job" so you need to have quotient.jobs.debug
logging category enabled to check this), if the request is actually sent you should see a bunch of log lines about the /sendToDevice
job.
Let me know about your findings :)
from libquotient.
The bug happened again. Took 5 days for it to happen, so I guess 5 days is when the encryption key needs to be sent to the new megolm session?
from libquotient.
Ok, I can try to look into this When I Got Time™️ Thanks for the explanation.
But of course if you or anyone else who might be reading this figures it out before me, no need to wait for me! 😂
from libquotient.
I have now confirmed that the bug happens after 100 messages. I used this tiny script with Neochat to confirm it
import os
import time
print("Starting message spam from 1 to 104")
time.sleep(5)
for i in range(1,105):
os.system(f"ydotool type {i}")
time.sleep(0.5)
os.system("ydotool key 28:1 28:0")
time.sleep(1)
print("Done")
I see if I can get some logs as well
from libquotient.
Here's some E2EE logs from the moment the key changes
quotient.e2ee: Encrypted event from "@akselmo:matrix.akselmo.dev"
quotient.e2ee: Sending room key to devices: "dUCrsgKk3ld7o3CZfjpCeAEPzrRkyLRAOKjaLkt5kW4" 99
quotient.e2ee: Encrypted event from "@akselmo:matrix.akselmo.dev"
quotient.e2ee: Creating new outbound megolm session for room "!NenIgaqPaTYiyHsFgQ:matrix.org"
quotient.e2ee: Allocated 256 bytes of secure heap (requested 160 bytes), 608 / 65536 bytes of secure heap used in total
quotient.e2ee: Deallocated 256 bytes, 352 / 65536 bytes of secure heap used
// The following keys stop working
quotient.e2ee: Adding inbound session "F4XBS129dMeJ5pBVCSkzM6M8I62kTTx/i/O+/u6oxgs"
quotient.e2ee: Sending room key to devices: "F4XBS129dMeJ5pBVCSkzM6M8I62kTTx/i/O+/u6oxgs" 0
quotient.e2ee: Encrypted event from "@akselmo:matrix.akselmo.dev"
quotient.e2ee: Consuming 1 to-device events
quotient.e2ee: Sending room key to devices: "F4XBS129dMeJ5pBVCSkzM6M8I62kTTx/i/O+/u6oxgs" 1
quotient.e2ee: Encrypted event from "@akselmo:matrix.akselmo.dev"
quotient.e2ee: Sending room key to devices: "F4XBS129dMeJ5pBVCSkzM6M8I62kTTx/i/O+/u6oxgs" 2
quotient.e2ee: Encrypted event from "@akselmo:matrix.akselmo.dev"
quotient.e2ee: Consuming 1 to-device events
from libquotient.
Here's with jobs debug log enabled
quotient.e2ee: Sending room key to devices: "P6hFlWi0MYN2pqOmu/H9cdwDWAG/j2XyJVH871mJOUA" 99
quotient.jobs: Sent PUT https://matrix.akselmo.dev/_matrix/client/v3/rooms/%21NenIgaqPaTYiyHsFgQ%3Amatrix.org/send/m.room.encrypted/DYVKWTJDNI1678544590874201
quotient.jobs: Sent PUT https://matrix.akselmo.dev/_matrix/client/v3/rooms/%21NenIgaqPaTYiyHsFgQ%3Amatrix.org/typing/%40akselmo%3Amatrix.akselmo.dev
quotient.jobs: 200 <- PUT https://matrix.akselmo.dev/_matrix/client/v3/rooms/%21NenIgaqPaTYiyHsFgQ%3Amatrix.org/typing/%40akselmo%3Amatrix.akselmo.dev
quotient.jobs: "SetTypingJob" destroyed
quotient.jobs: Sent GET https://matrix.akselmo.dev/_matrix/client/v3/notifications
quotient.jobs: 200 <- PUT https://matrix.akselmo.dev/_matrix/client/v3/rooms/%21NenIgaqPaTYiyHsFgQ%3Amatrix.org/send/m.room.encrypted/DYVKWTJDNI1678544590874201
quotient.jobs: "SendMessageJob" destroyed
quotient.e2ee: Encrypted event from "@akselmo:matrix.akselmo.dev"
quotient.jobs: 200 <- GET https://matrix.akselmo.dev/_matrix/client/v3/notifications
quotient.jobs: Sent GET https://matrix.akselmo.dev/_matrix/client/v3/notifications
quotient.jobs: "GetNotificationsJob" destroyed
quotient.jobs: 200 <- GET https://matrix.akselmo.dev/_matrix/client/v3/notifications
quotient.jobs: "GetNotificationsJob" destroyed
quotient.jobs: Sent POST https://matrix.akselmo.dev/_matrix/client/v3/rooms/%21NenIgaqPaTYiyHsFgQ%3Amatrix.org/read_markers
quotient.jobs: 200 <- POST https://matrix.akselmo.dev/_matrix/client/v3/rooms/%21NenIgaqPaTYiyHsFgQ%3Amatrix.org/read_markers
quotient.jobs: Sent GET https://matrix.akselmo.dev/_matrix/client/v3/notifications
quotient.jobs: "SetReadMarkerJob" destroyed
quotient.jobs: Sent PUT https://matrix.akselmo.dev/_matrix/client/v3/rooms/%21NenIgaqPaTYiyHsFgQ%3Amatrix.org/typing/%40akselmo%3Amatrix.akselmo.dev
quotient.jobs: Sent GET https://matrix.akselmo.dev/_matrix/client/v3/notifications
quotient.jobs: 200 <- GET https://matrix.akselmo.dev/_matrix/client/v3/notifications
quotient.jobs: "GetNotificationsJob" destroyed
quotient.jobs: 200 <- PUT https://matrix.akselmo.dev/_matrix/client/v3/rooms/%21NenIgaqPaTYiyHsFgQ%3Amatrix.org/typing/%40akselmo%3Amatrix.akselmo.dev
quotient.jobs: "SetTypingJob" destroyed
quotient.jobs: Sent GET https://matrix.akselmo.dev/_matrix/client/v3/notifications
quotient.jobs: 200 <- GET https://matrix.akselmo.dev/_matrix/client/v3/notifications
quotient.jobs: "GetNotificationsJob" destroyed
quotient.jobs: 200 <- GET https://matrix.akselmo.dev/_matrix/client/v3/notifications
quotient.jobs: "GetNotificationsJob" destroyed
quotient.e2ee: Creating new outbound megolm session for room "!NenIgaqPaTYiyHsFgQ:matrix.org"
quotient.e2ee: Allocated 256 bytes of secure heap (requested 160 bytes), 624 / 65536 bytes of secure heap used in total
quotient.e2ee: Deallocated 256 bytes, 368 / 65536 bytes of secure heap used
quotient.e2ee: Adding inbound session "DSpBcQ2LBG7v7iGgCDgyB/o8OyUqwVq33RHdceG6n/c"
quotient.e2ee: Sending room key to devices: "DSpBcQ2LBG7v7iGgCDgyB/o8OyUqwVq33RHdceG6n/c" 0
quotient.jobs: Sent PUT https://matrix.akselmo.dev/_matrix/client/v3/rooms/%21NenIgaqPaTYiyHsFgQ%3Amatrix.org/send/m.room.encrypted/DYVKWTJDNI1678544590874203
quotient.jobs: Sent PUT https://matrix.akselmo.dev/_matrix/client/v3/rooms/%21NenIgaqPaTYiyHsFgQ%3Amatrix.org/typing/%40akselmo%3Amatrix.akselmo.dev
quotient.jobs: 200 <- PUT https://matrix.akselmo.dev/_matrix/client/v3/rooms/%21NenIgaqPaTYiyHsFgQ%3Amatrix.org/typing/%40akselmo%3Amatrix.akselmo.dev
quotient.jobs: "SetTypingJob" destroyed
quotient.jobs: Sent GET https://matrix.akselmo.dev/_matrix/client/v3/notifications
quotient.jobs: 200 <- PUT https://matrix.akselmo.dev/_matrix/client/v3/rooms/%21NenIgaqPaTYiyHsFgQ%3Amatrix.org/send/m.room.encrypted/DYVKWTJDNI1678544590874203
quotient.jobs: "SendMessageJob" destroyed
quotient.jobs: 200 <- GET https://matrix.akselmo.dev/_matrix/client/v3/notifications
quotient.e2ee: Encrypted event from "@akselmo:matrix.akselmo.dev"
quotient.jobs: "GetNotificationsJob" destroyed
quotient.jobs: Sent GET https://matrix.akselmo.dev/_matrix/client/v3/notifications
quotient.e2ee: Consuming 1 to-device events
quotient.jobs: 200 <- GET https://matrix.akselmo.dev/_matrix/client/v3/notifications
quotient.jobs: Sent GET https://matrix.akselmo.dev/_matrix/client/v3/notifications
quotient.jobs: "GetNotificationsJob" destroyed
quotient.jobs: 200 <- GET https://matrix.akselmo.dev/_matrix/client/v3/notifications
quotient.jobs: "GetNotificationsJob" destroyed
quotient.jobs: Sent POST https://matrix.akselmo.dev/_matrix/client/v3/rooms/%21NenIgaqPaTYiyHsFgQ%3Amatrix.org/read_markers
quotient.jobs: Sent PUT https://matrix.akselmo.dev/_matrix/client/v3/rooms/%21NenIgaqPaTYiyHsFgQ%3Amatrix.org/typing/%40akselmo%3Amatrix.akselmo.dev
quotient.jobs: 200 <- POST https://matrix.akselmo.dev/_matrix/client/v3/rooms/%21NenIgaqPaTYiyHsFgQ%3Amatrix.org/read_markers
quotient.jobs: Sent GET https://matrix.akselmo.dev/_matrix/client/v3/notifications
quotient.jobs: "SetReadMarkerJob" destroyed
quotient.jobs: 200 <- PUT https://matrix.akselmo.dev/_matrix/client/v3/rooms/%21NenIgaqPaTYiyHsFgQ%3Amatrix.org/typing/%40akselmo%3Amatrix.akselmo.dev
quotient.jobs: "SetTypingJob" destroyed
quotient.jobs: Sent GET https://matrix.akselmo.dev/_matrix/client/v3/notifications
quotient.jobs: 200 <- GET https://matrix.akselmo.dev/_matrix/client/v3/notifications
quotient.jobs: "GetNotificationsJob" destroyed
quotient.jobs: 200 <- GET https://matrix.akselmo.dev/_matrix/client/v3/notifications
quotient.jobs: "GetNotificationsJob" destroyed
quotient.jobs: Sent GET https://matrix.akselmo.dev/_matrix/client/v3/notifications
quotient.jobs: 200 <- GET https://matrix.akselmo.dev/_matrix/client/v3/notifications
quotient.jobs: "GetNotificationsJob" destroyed
I can't see /sendToDevice
logs here, unless those PUT messages are them.
Also, seems when I reached 100 messages, Nheko suddenly gave me a warning that the device (Neochat after 100 messages) is unverified.
from libquotient.
Is the hash empty here and thus nothing happens?
libQuotient/lib/connection.cpp
Line 2445 in 3c1c4f0
from libquotient.
Related Issues (20)
- Warning "Trying to add the user "@...." but it's already in the user list" then SEGV HOT 3
- Connection::userId() is empty before authentication HOT 1
- 0.8 RC
- Pinned messages event is not what is specced HOT 1
- Release 0.8.0
- Wrong required library name libQuotientQt60_8 HOT 7
- NetworkAccessManager doesn't work with authenticating media servers
- Event types registered twice QT6 HOT 8
- Release 0.8.1
- ABI break in patch version 0.8.1 HOT 1
- The library emits no signal when allHistoryLoaded() becomes apparent
- Release 0.8.1.2
- Release 0.8.2
- Message edits lost after restarts HOT 1
- Thoughts about a matrix-rust-sdk connection
- Quotient::NAM doesn't retry on errors
- Update to Matrix 1.10
- Add toJson() for events and get rid of CreateRoomJob::StateEvent
- event->redactedBecause() can return a pointer to a deleted event HOT 5
- Room State Cache saved too often HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libquotient.