Skip to content

MSC4140: Delayed events #4140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 85 commits into
base: main
Choose a base branch
from
Open

Conversation

toger5
Copy link

@toger5 toger5 commented May 7, 2024

toger5 added 2 commits May 7, 2024 18:52
@toger5 toger5 force-pushed the toger5/expiring-events-keep-alive branch from 2bc07c4 to 0eb1abc Compare May 7, 2024 17:03
@toger5 toger5 force-pushed the toger5/expiring-events-keep-alive branch from 0eb1abc to 8bf6db7 Compare May 8, 2024 15:49
Signed-off-by: Timo K <[email protected]>
@turt2live turt2live changed the title Draft for expiring event PR MSC4140: Expiring events with keep alive endpoint May 9, 2024
@turt2live turt2live added proposal A matrix spec change proposal client-server Client-Server API kind:feature MSC for not-core and not-maintenance stuff needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. labels May 9, 2024
@toger5 toger5 force-pushed the toger5/expiring-events-keep-alive branch from 3e54c2a to c82adf7 Compare May 10, 2024 17:54
@toger5 toger5 force-pushed the toger5/expiring-events-keep-alive branch from c82adf7 to 54fff99 Compare May 10, 2024 18:08
toger5 added 3 commits May 13, 2024 16:56
…is used to trigger on of the actions

Signed-off-by: Timo K <[email protected]>
Add event type to the body
Add event id template variable
@AndrewFerr
Copy link
Member

AndrewFerr commented Sep 19, 2024

As suggested during a review of Complement tests, this MSC should specify what happens when a user leaves a room they have pending delayed messages for.

The most "unsurprising" thing to do is to cancel all delayed events for a room when leaving it.

On the other hand, not cancelling them is an option as well:

  • If the user rejoins a room they had left, any of their still-pending delayed messages for that room will end up getting sent
  • If the user is not in a room by the time any of their delayed messages for that room are to be sent, the event sending will simply fail with a 400-class error

The latter is in the same vein as evaluating power levels at the point of sending.

Note that the Synapse implementation does not cancel delayed events for left rooms.

Comment on lines +255 to +256
Power levels are evaluated for each event only once the delay has occurred and it will be distributed/inserted into the
DAG. This implies a delayed event can fail if it violates power levels at the time the delay passes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should users be notified of delayed events that hit power level failures (or any 400-class error) upon being sent?

If so, perhaps delayed event send failures can be included in /sync responses, for clients to handle however they like.

If not, then this spec should make it explicit that delayed event send failures are effectively unhandled.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a really good comment.
Adding it to the sync response Sounds as if we would need to introduce a place for error messages there. Which be a very new concept I think.

What about adding it to the get delayed events endpoint.
We don't known if the client will be online if the failiour occurs so it is a very async check for errors anyways so making it part of a request does not sound too bad.
I don't know how to remove errors from the get delayed events list. Maybe as soon as they are fetched once they get removed?

Is that an issue if there are more clients getting futures?

Maybe each client should get the errors once?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this into the GET endpoint.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would an event failure be something that a client needs to act upon? If so, the client would need to continuously poll this endpoint, which is starting to feel a lot like /sync...

Comment on lines +109 to +110
- `delay` - Optional number of milliseconds the homeserver should wait before sending the event. If no `delay` is provided,
the event is sent immediately as normal.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to support setting the absolute target time rather than relative?
I was thinking of possibly using this as a "hack" to make sure a bunch of state event changes are batched in a single federation transaction by scheduling them at a single point in time ~5-10 seconds in the future. (eg. a moderation bot doing wildcard kicks/bans, or redacting tens if not hundreds of spam messages, this would allow for far higher event throughput and reduce federation overhead, where the bot may already be exempted from rate limits)

Just a thought, no intent to block this MSC.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The federation overhead should be the same, because the same amount of content (in your case, the moderation actions) will be sent in the request whether they're delayed or immediate events.

Unless you meant something else?

toger5 and others added 7 commits October 2, 2024 13:21
…hort term and longer term send_pdus is the better solution.
 - we have two GET endpoints `/shedueled` `/terminated` now.
 - The rule for when a state delayed event is cancelled changed to include a sender user condition.
yingziwu added a commit to yingziwu/synapse that referenced this pull request Oct 17, 2024
No significant changes since 1.117.0rc1.

- Add config option `redis.password_path`. ([\#17717](element-hq/synapse#17717))

- Fix a rare bug introduced in v1.29.0 where invalidating a user's access token from a worker could raise an error. ([\#17779](element-hq/synapse#17779))
- In the response to `GET /_matrix/client/versions`, set the `unstable_features` flag for [MSC4140](matrix-org/matrix-spec-proposals#4140) to `false` when server configuration disables support for delayed events. ([\#17780](element-hq/synapse#17780))
- Improve input validation and room membership checks in admin redaction API. ([\#17792](element-hq/synapse#17792))

- Clarify the docstring of `test_forget_when_not_left`. ([\#17628](element-hq/synapse#17628))
- Add documentation note about PYTHONMALLOC for accurate jemalloc memory tracking. Contributed by @hensg. ([\#17709](element-hq/synapse#17709))
- Remove spurious "TODO UPDATE ALL THIS" note in the Debian installation docs. ([\#17749](element-hq/synapse#17749))
- Explain how load balancing works for `federation_sender_instances`. ([\#17776](element-hq/synapse#17776))

- Minor performance increase for large accounts using sliding sync. ([\#17751](element-hq/synapse#17751))
- Increase performance of the notifier when there are many syncing users. ([\#17765](element-hq/synapse#17765), [\#17766](element-hq/synapse#17766))
- Fix performance of streams that don't change often. ([\#17767](element-hq/synapse#17767))
- Improve performance of sliding sync connections that do not ask for any rooms. ([\#17768](element-hq/synapse#17768))
- Reduce overhead of sliding sync E2EE loops. ([\#17771](element-hq/synapse#17771))
- Sliding sync minor performance speed up using new table. ([\#17787](element-hq/synapse#17787))
- Sliding sync minor performance improvement by omitting unchanged data from incremental responses. ([\#17788](element-hq/synapse#17788))
- Speed up sliding sync when there are many active subscriptions. ([\#17789](element-hq/synapse#17789))
- Add missing license headers on new source files. ([\#17799](element-hq/synapse#17799))

* Bump phonenumbers from 8.13.45 to 8.13.46. ([\#17773](element-hq/synapse#17773))
* Bump python-multipart from 0.0.10 to 0.0.12. ([\#17772](element-hq/synapse#17772))
* Bump regex from 1.10.6 to 1.11.0. ([\#17770](element-hq/synapse#17770))
* Bump ruff from 0.6.7 to 0.6.8. ([\#17774](element-hq/synapse#17774))
@spaetz
Copy link

spaetz commented Feb 25, 2025

Given element-call is the default VOIP solution in EX clients, and I CONSTANTLY have to help people to get calls unstuck (so often that I had to write up instructions on how toresolve them at https://sspaeth.de/2025/02/how-to-resolve-stuck-matrixrtc-calls/ :-).
So it would be a blast to get this one moving again. Thanks for considering.

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Mar 27, 2025
Fixes high severity vulnerability *exploited in the wild*!


# Synapse 1.127.1 (2025-03-26)

## Security
- Fix [CVE-2025-30355](https://www.cve.org/CVERecord?id=CVE-2025-30355) / [GHSA-v56r-hwv5-mxg6](GHSA-v56r-hwv5-mxg6). **High severity vulnerability affecting federation. The vulnerability has been exploited in the wild.**



# Synapse 1.127.0 (2025-03-25)

No significant changes since 1.127.0rc1.




# Synapse 1.127.0rc1 (2025-03-18)

### Features

- Update [MSC4140](matrix-org/matrix-spec-proposals#4140) implementation to no longer cancel a user's own delayed state events with an event type & state key that match a more recent state event sent by that user. ([\#17810](element-hq/synapse#17810))

### Improved Documentation

- Fixed a minor typo in the Synapse documentation. Contributed by @karuto12. ([\#18224](element-hq/synapse#18224))

### Internal Changes

- Remove undocumented `SYNAPSE_USE_FROZEN_DICTS` environment variable. ([\#18123](element-hq/synapse#18123))
- Fix detection of workflow failures in the release script. ([\#18211](element-hq/synapse#18211))
- Add caching support to media endpoints. ([\#18235](element-hq/synapse#18235))



### Updates to locked dependencies

* Bump anyhow from 1.0.96 to 1.0.97. ([\#18201](element-hq/synapse#18201))
* Bump bcrypt from 4.2.1 to 4.3.0. ([\#18207](element-hq/synapse#18207))
* Bump bytes from 1.10.0 to 1.10.1. ([\#18227](element-hq/synapse#18227))
* Bump http from 1.2.0 to 1.3.1. ([\#18245](element-hq/synapse#18245))
* Bump sentry-sdk from 2.19.2 to 2.22.0. ([\#18205](element-hq/synapse#18205))
* Bump serde from 1.0.218 to 1.0.219. ([\#18228](element-hq/synapse#18228))
* Bump serde_json from 1.0.139 to 1.0.140. ([\#18202](element-hq/synapse#18202))
* Bump ulid from 1.2.0 to 1.2.1. ([\#18246](element-hq/synapse#18246))
yingziwu added a commit to yingziwu/synapse that referenced this pull request Apr 13, 2025
No significant changes since 1.127.0rc1.

- Update [MSC4140](matrix-org/matrix-spec-proposals#4140) implementation to no longer cancel a user's own delayed state events with an event type & state key that match a more recent state event sent by that user. ([\#17810](element-hq/synapse#17810))

- Fixed a minor typo in the Synapse documentation. Contributed by @karuto12. ([\#18224](element-hq/synapse#18224))

- Remove undocumented `SYNAPSE_USE_FROZEN_DICTS` environment variable. ([\#18123](element-hq/synapse#18123))
- Fix detection of workflow failures in the release script. ([\#18211](element-hq/synapse#18211))
- Add caching support to media endpoints. ([\#18235](element-hq/synapse#18235))

* Bump anyhow from 1.0.96 to 1.0.97. ([\#18201](element-hq/synapse#18201))
* Bump bcrypt from 4.2.1 to 4.3.0. ([\#18207](element-hq/synapse#18207))
* Bump bytes from 1.10.0 to 1.10.1. ([\#18227](element-hq/synapse#18227))
* Bump http from 1.2.0 to 1.3.1. ([\#18245](element-hq/synapse#18245))
* Bump sentry-sdk from 2.19.2 to 2.22.0. ([\#18205](element-hq/synapse#18205))
* Bump serde from 1.0.218 to 1.0.219. ([\#18228](element-hq/synapse#18228))
* Bump serde_json from 1.0.139 to 1.0.140. ([\#18202](element-hq/synapse#18202))
* Bump ulid from 1.2.0 to 1.2.1. ([\#18246](element-hq/synapse#18246))
@toger5 toger5 changed the title MSC4140: Cancellable delayed events MSC4140: Delayed events Apr 15, 2025
@turt2live turt2live added implementation-needs-checking The MSC has an implementation, but the SCT has not yet checked it. and removed needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. labels Apr 15, 2025
@turt2live
Copy link
Member

MSCs proposed for Final Comment Period (FCP) should meet the requirements outlined in the checklist prior to being accepted into the spec. This checklist is a bit long, but aims to reduce the number of follow-on MSCs after a feature lands.

SCT members: please check off things you check for, and raise a concern against FCP if the checklist is incomplete. If an item doesn't apply, prefer to check it rather than remove it. Unchecking items is encouraged where applicable.

Checklist:

  • Are appropriate implementation(s)
    specified in the MSC’s PR description?
  • Are all MSCs that this MSC depends on already accepted?
  • For each new endpoint that is introduced:
    • Have authentication requirements been specified?
    • Have rate-limiting requirements been specified?
    • Have guest access requirements been specified?
    • Are error responses specified?
      • Does each error case have a specified errcode (e.g. M_FORBIDDEN) and HTTP status code?
        • If a new errcode is introduced, is it clear that it is new?
  • Will the MSC require a new room version, and if so, has that been made clear?
    • Is the reason for a new room version clearly stated? For example,
      modifying the set of redacted fields changes how event IDs are calculated,
      thus requiring a new room version.
  • Are backwards-compatibility concerns appropriately addressed?
  • Are the endpoint conventions honoured?
    • Do HTTP endpoints use_underscores_like_this?
    • Will the endpoint return unbounded data? If so, has pagination been considered?
    • If the endpoint utilises pagination, is it consistent with
      the appendices?
  • An introduction exists and clearly outlines the problem being solved.
    Ideally, the first paragraph should be understandable by a non-technical audience.
  • All outstanding threads are resolved
    • All feedback is incorporated into the proposal text itself, either as a fix or noted as an alternative
  • While the exact sections do not need to be present,
    the details implied by the proposal template are covered. Namely:
    • Introduction
    • Proposal text
    • Potential issues
    • Alternatives
    • Dependencies
  • Stable identifiers are used throughout the proposal, except for the unstable prefix section
    • Unstable prefixes consider the awkward accepted-but-not-merged state
    • Chosen unstable prefixes do not pollute any global namespace (use “org.matrix.mscXXXX”, not “org.matrix”).
  • Changes have applicable Sign Off from all authors/editors/contributors
  • There is a dedicated "Security Considerations" section which detail
    any possible attacks/vulnerabilities this proposal may introduce, even if this is "None.".
    See RFC3552 for things to think about,
    but in particular pay attention to the OWASP Top Ten.

@github-project-automation github-project-automation bot moved this to Needs idea feedback / initial review in Spec Core Team Backlog Apr 15, 2025
@turt2live turt2live moved this from Needs idea feedback / initial review to Ready for FCP ticks in Spec Core Team Backlog Apr 15, 2025
@turt2live turt2live moved this from Ready for FCP ticks to Proposed for FCP readiness in Spec Core Team Backlog Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client-server Client-Server API implementation-needs-checking The MSC has an implementation, but the SCT has not yet checked it. kind:feature MSC for not-core and not-maintenance stuff proposal A matrix spec change proposal
Projects
Status: Proposed for FCP readiness
Development

Successfully merging this pull request may close these issues.