Limit outgoing to_device EDU size to 65536#18416
Limit outgoing to_device EDU size to 65536#18416MadLittleMods merged 57 commits intoelement-hq:developfrom
Conversation
From my review of #18416
Co-authored-by: Eric Eastwood <madlittlemods@gmail.com>
Co-authored-by: Eric Eastwood <madlittlemods@gmail.com>
Co-authored-by: Eric Eastwood <madlittlemods@gmail.com>
Co-authored-by: Eric Eastwood <madlittlemods@gmail.com>
|
Looks like the CI tests are flaky as mentioned here : #18537 |
|
Not able to reproduce the issue here by running |
synapse/handlers/devicemessage.py
Outdated
| if len(current_edu_content["messages"]) == 0: | ||
| raise EventSizeError( | ||
| f"device message to {recipient} too large to fit in a single EDU", | ||
| unpersistable=True, | ||
| ) |
There was a problem hiding this comment.
We should link it in the code here
I am not sure what you meant here, and for whatever reason I can't comment in the thread. |
|
Relevant thread is here: #18416 (comment) (press 'load more' when viewing the conversations to get everything visible) We should link your spec PR in the code where we raise |
MadLittleMods
left a comment
There was a problem hiding this comment.
Looks good. I'm unable to apply the last edits
Co-authored-by: Eric Eastwood <madlittlemods@gmail.com>
|
Thanks for the fix @MatMaul 🐏 |
|
We did it! Thanks for the reviews 🙏 |
Spawning from #18416 (comment)
…clock) (#19602) Spawning from #18416 (comment)
This reverts commit 7fad50f.
Reverts #18416 Unfortunately, this causes failures on `/sendToDevice` endpoint in normal circumstances. If a single user has, say, a hundred devices then we easily go over the limit. This blocks message sending entirely in encrypted rooms. cc @MadLittleMods @MatMaul
If a set of messages exceeds this limit, the messages are split across several EDUs. Fix #17035 (should) There is currently [no official specced limit for EDUs](matrix-org/matrix-spec#807), but the consensus seems to be that it would be useful to have one to avoid this bug by bounding the transaction size. As a side effect it also limits the size of a single to-device message to a bit less than 65536. This should probably be added to the spec similarly to the [message size limit.](https://spec.matrix.org/v1.14/client-server-api/#size-limits) Spec PR: matrix-org/matrix-spec#2340 --------- Co-authored-by: mcalinghee <mcalinghee.dev@gmail.com> Co-authored-by: Eric Eastwood <madlittlemods@gmail.com>
This is based on #18416, which got reverted due to it rejecting to-device messages to users with many devices. The main change here is that if a to-device EDU for a single user is too large, then we split it up into multiple EDUs.
This is based on #18416, which got reverted due to it rejecting to-device messages to users with many devices. The main change here is that if a to-device EDU for a single user is too large, then we split it up into multiple EDUs.

If a set of messages exceeds this limit, the messages are split across several EDUs.
Fix #17035 (should)
There is currently no official specced limit for EDUs, but the consensus seems to be that it would be useful to have one to avoid this bug by bounding the transaction size.
As a side effect it also limits the size of a single to-device message to a bit less than 65536.
This should probably be added to the spec similarly to the message size limit..
Spec PR: matrix-org/matrix-spec#2340
Pull Request Checklist