aboutsummaryrefslogtreecommitdiff
path: root/roomserver/internal/input
AgeCommit message (Collapse)Author
2024-02-21Speed up start up time by batch querying ACL events (#3334)Till
This should significantly speed up start up times on servers with many rooms.
2024-01-24Update sentry reporting (#3305)Till
This hopefully reduces the garbage we currently produce. (Using [GlitchTip](https://glitchtip.com/) on my personal instance, this seems to look better)
2023-12-19Use `AckExplicitPolicy` instead of `AckAllPolicy` (#3288)Till
Fixes https://github.com/matrix-org/dendrite/issues/3240 and potentially a root cause for state resets. While testing, I've had added some more debug logging: ``` time="2023-12-16T18:13:11.319458084Z" level=warning msg="already processed event" event_id="$qFYMl_F2vb1N0yxmvlFAMhqhGhLKq4kA-o_YCQKH7tQ" kind=KindNew times=2 time="2023-12-16T18:13:14.537389126Z" level=warning msg="already processed event" event_id="$EU-LTsKErT6Mt1k12-p_3xOHfiLaK6gtwVDlZ35lSuo" kind=KindNew times=5 time="2023-12-16T18:13:16.789551206Z" level=warning msg="already processed event" event_id="$dIPuAfTL5x0VyG873LKPslQeljCSxFT1WKxUtjIMUGE" kind=KindNew times=5 time="2023-12-16T18:13:17.383838767Z" level=warning msg="already processed event" event_id="$7noSZiCkzerpkz_UBO3iatpRnaOiPx-3IXc0GPDQVGE" kind=KindNew times=2 time="2023-12-16T18:13:22.091946597Z" level=warning msg="already processed event" event_id="$3Lvo3Wbi2ol9-nNbQ93N-E2MuGQCJZo5397KkFH-W6E" kind=KindNew times=1 time="2023-12-16T18:13:23.026417446Z" level=warning msg="already processed event" event_id="$lj1xS46zsLBCChhKOLJEG-bu7z-_pq9i_Y2DUIjzGy4" kind=KindNew times=4 ``` So we did receive the same event over and over again. Given they are `KindNew`, we don't short circuit if we already processed them, which potentially caused the state to be calculated with a now wrong state snapshot. Also fixes the back pressure metric. We now correctly increment the counter once we sent the message to NATS and decrement it once we actually processed an event.
2023-11-22Update ACLs when received as outliers (#3008)Till
This should fix #3004 by making sure we also update our in-memory ACLs after joining a new room. Also makes use of more caching in `GetStateEvent` Bonus: Adds some tests, as I was about to use `GetBulkStateContent`, but turns out that `GetStateEvent` is basically doing the same, just that it only gets the `eventTypeNID`/`eventStateKeyNID` once and not for every call.
2023-10-25Check event is not rejected (#3243)Till
Companion PR to https://github.com/matrix-org/gomatrixserverlib/pull/421
2023-09-15Update gmsl to use new validated RoomID on PDUs (#3200)devonh
GMSL returns a `spec.RoomID` when calling `PDU.RoomID()`
2023-08-24[pseudoIDs] More pseudo ID fixes - Part 2 (#3181)Sam Wedgwood
Fixes include: - Translating state keys that contain user IDs to their respective room keys for both querying and sending state events - **NOTE**: there may be design discussion needed on what should happen when sender keys cannot be found for users - A simple fix for kicking guests from rooms properly - Logic for boundary history visibilities was slightly off (I'm surprised this only manifested in pseudo ID room versions) Signed-off-by: `Sam Wedgwood <sam@wedgwood.dev>`
2023-07-21Fix event federation with pseudoID rooms (#3156)devonh
2023-07-07Add event size checks similar to Synapse (#3140)Till
Companion to https://github.com/matrix-org/gomatrixserverlib/pull/400 This tries to mimic the logic found in Synapse, as dropping events can break rooms (and we may end up in endless loops..)
2023-07-05Fix metrics..Till Faelligen
2023-06-28Add `MXIDMapping` for pseudoID rooms (#3112)Till
Add `MXIDMapping` on membership events when creating/joining rooms.
2023-06-14Merge SenderID & Per Room User Key work (#3109)devonh
2023-06-12Cleanup remaining statekey usage for senderIDs (#3106)devonh
2023-06-07Use SenderID Type (#3105)devonh
2023-06-06PDU Sender split (#3100)devonh
Initial cut of splitting PDU Sender into SenderID & looking up UserID where required.
2023-05-31Move CreateRoom logic to Roomserver (#3093)devonh
Move create room logic over to roomserver.
2023-05-24Drop `reference_sha` column (#3083)Till
Companion PR to https://github.com/matrix-org/gomatrixserverlib/pull/383
2023-05-09Move json errors over to gmsl (#3080)devonh
2023-05-08Only require room version instead of room info for db.Events() (#3079)devonh
This reduces the API requirements for the Events database to align with what is actually required.
2023-05-04Use ProtoEvent where needed instead of EventBuilder (#3075)kegsay
They are fundamentally different concepts, so should be represented as such. Proto events are exchanged in /make_xxx calls over federation, and made as "fledgling" events in /createRoom and general event sending. *Building* events is a reasonably complex VERSION SPECIFIC process which needs amongst other things, auth event providers, prev events, signing keys, etc. Requires https://github.com/matrix-org/gomatrixserverlib/pull/379
2023-05-03Use PDU in even more places (#3074)kegsay
- No longer rely on *Event returning from NewEventFrom... functions Requires https://github.com/matrix-org/gomatrixserverlib/pull/377
2023-05-02Use PDU not *Event in HeaderedEvent (#3073)kegsay
Requires https://github.com/matrix-org/gomatrixserverlib/pull/376 This has numerous upsides: - Less type casting to `*Event` is required. - Making Dendrite work with `PDU` interfaces means we can swap out Event impls more easily. - Tests which represent weird event shapes are easier to write. Part of a series of refactors on GMSL.
2023-04-27Use PDU interface (#3070)kegsay
We only use it in a few places currently, enough to get things to compile and run. We should be using it in much more places. Similarly, in some places we cast []PDU back to []*Event, we need to not do that. Likewise, in some places we cast PDU to *Event, we need to not do that. For now though, hopefully this is a start.
2023-04-27Remove gmsl.HeaderedEvent (#3068)kegsay
Replaced with types.HeaderedEvent _for now_. In reality we want to move them all to gmsl.Event and only use HeaderedEvent when we _need_ to bundle the version/event ID with the event (seriailsation boundaries, and even then only when we don't have the room version). Requires https://github.com/matrix-org/gomatrixserverlib/pull/373
2023-04-27Add some roomserver UTs (#3067)Till
Adds tests for `QueryRestrictedJoinAllowed`, `IsServerAllowed` and `PerformRoomUpgrade`. Refactors the `QueryRoomVersionForRoom` method to accept a string and return a `gmsl.RoomVersion` instead of req/resp structs. Adds some more caching for `GetStateEvent` This should also fix #2912 by ignoring state events belonging to other users.
2023-04-21Implement new RoomVersionImpl API (#3062)kegsay
As outlined in https://github.com/matrix-org/gomatrixserverlib/pull/368 The main change Dendrite side is that `RoomVersion` no longer has any methods on it. Instead, you need to bounce via `gmsl.GetRoomVersion`. It's very interesting to see where exactly Dendrite cares about this. For some places it's creating events (fine) but others are way more specific. Those areas will need to migrate to GMSL at some point.
2023-04-20refactor: funnel event creation through room versions (#3060)kegsay
In preparation of interfacing up the room version value.
2023-04-19refactor: update GMSL (#3058)kegsay
Sister PR to https://github.com/matrix-org/gomatrixserverlib/pull/364 Read this commit by commit to avoid going insane.
2023-04-14Update GMSL: use static Check functions (#3052)kegsay
Sister PR to https://github.com/matrix-org/gomatrixserverlib/pull/359 A nice side effect is that we don't need to re-parse the events in some cases.
2023-04-06refactor: use latest GMSL which splits fed client from matrix room logic (#3051)kegsay
Part of a series of refactors on GMSL.
2023-03-22Remove `BaseDendrite` (#3023)Till
Removes `BaseDendrite` to, hopefully, make testing and composing of components easier in the future.
2023-03-17Preparations for removing `BaseDendrite` (#3016)Till
Preparations to actually remove/replace `BaseDendrite`. Quite a few changes: - SyncAPI accepts an `fulltext.Indexer` interface (fulltext is removed from `BaseDendrite`) - Caches are removed from `BaseDendrite` - Introduces a `Router` struct (likely to change) - also fixes #2903 - Introduces a `sqlutil.ConnectionManager`, which should remove `base.DatabaseConnection` later on - probably more
2023-03-13Add basic runtime tracing (#2996)Till
This allows us in almost all places to use regions to further trace down long running tasks. Also removes an unused function.
2023-03-03Make redaction check easier to read (#2995)Till
We need to check the redaction PL in Dendrite, if we do it in GMSL, we end up not sending the event to the output stream because it will be rejected. --------- Co-authored-by: kegsay <kegan@matrix.org>
2023-03-01Refactor `StoreEvent`, add `MaybeRedactEvent`, create an `EventDatabase` (#2989)Till
This PR changes the following: - `StoreEvent` now only stores an event (and possibly prev event), instead of also doing redactions - Adds a `MaybeRedactEvent` (pulled out from `StoreEvent`), which should be called after storing events - a few other things
2023-02-24Refactor `StoreEvent` and create a new `RoomDatabase` interface (#2985)Till
This PR changes a few things: - It pulls out the creation of several NIDs from the `StoreEvent` function to make the functions more reusable - Uses more caching when using those NIDs to avoid DB round trips
2023-01-20AWSY missing federation tests (#2943)Till
In an attempt to fix the missing AWSY tests and to get to 100% server-server compliance.
2022-12-22Handle guest access [1/2?] (#2872)Till
Needs https://github.com/matrix-org/sytest/pull/1315, as otherwise the membership events aren't persisted yet when hitting `/state` after kicking guest users. Makes the following tests pass: ``` Guest users denied access over federation if guest access prohibited Guest users are kicked from guest_access rooms on revocation of guest_access Guest users are kicked from guest_access rooms on revocation of guest_access over federation ``` Todo (in a follow up PR): - Restrict access to CS API Endpoints as per https://spec.matrix.org/v1.4/client-server-api/#client-behaviour-14 Co-authored-by: kegsay <kegan@matrix.org>
2022-11-15Don't get blacklisted hosts when querying joined servers (#2880)Neil Alexander
Otherwise we just waste time/CPU.
2022-11-15Federation fixes for virtual hostingNeil Alexander
2022-11-14Handle remote room upgrades (#2866)Till
Makes the following tests pass ``` /upgrade moves remote aliases to the new room Local and remote users' homeservers remove a room from their public directory on upgrade ```
2022-11-02Improve logging for `processEventWithMissingState`Neil Alexander
2022-10-14Set inactivity threshold on durable consumers in the roomserver input API ↵Neil Alexander
(#2795) This prevents us from holding onto durable consumers indefinitely for rooms that have long since turned inactive, since they do have a bit of a processing overhead in the NATS Server. If we clear up a consumer and then a room becomes active again, the consumer gets recreated as needed. The threshold is set to 24 hours for now, we can tweak it later if needs be.
2022-10-14Fix `outliers whose auth_events are in a different room are correctly ↵Till
rejected` (#2791) Fixes `outliers whose auth_events are in a different room are correctly rejected`, by validating that auth events are all from the same room and not using rejected events for event auth.
2022-10-06Don't try to talk to ourselves when finding missing eventsNeil Alexander
2022-09-26Remove `origin` field from PDUs (#2737)Neil Alexander
This nukes the `origin` field from PDUs as per matrix-org/matrix-spec#998, matrix-org/gomatrixserverlib#341.
2022-09-16Ensure that all state event IDs are included in the `added` section when ↵Neil Alexander
rewriting state (#2725) This should hopefully fix an entire class of problems where components downstream from the roomserver (i.e. the sync API) could just lose a whole bunch of state after a rewrite operation like a federated join. The root of the bug is that we set `RewritesState` in the output event which instructs downstream components to purge their copy of any room state, but then didn't send the entire state snapshot in `adds_state_event_ids` so the downstream state ends up being incomplete as a result.
2022-09-14Revert 482914aef4a7d637a8c468d46904fde9f478b5d1Neil Alexander
2022-09-13Use `AckNone` on the ephemeral room input consumerNeil Alexander
2022-09-12Fix missing signature check on the `/get_missing_events` responseNeil Alexander