summary refs log tree commit diff
path: root/synapse/replication/http/presence.py (unfollow)
Commit message (Collapse)AuthorFilesLines
2021-05-12wip github/anoa/module_api_full_presence_fix_wip anoa/module_api_full_presence_fix_wipAndrew Morgan1-0/+1
2021-05-11force_notify nonsenseAndrew Morgan3-7/+12
2021-05-11Tests for to-device messages (#9965)Richard van der Hoff2-0/+202
2021-05-11Sort child events according to MSC1772 for the spaces summary API. (#9954)Patrick Cloke3-2/+151
This should help ensure that equivalent results are achieved between homeservers querying for the summary of a space. This implements modified MSC1772 rules, according to MSC2946. The different is that the origin_server_ts of the m.room.create event is not used as a tie-breaker since this might not be known if the homeserver is not part of the room.
2021-05-11Fix stream token multiple devicesAndrew Morgan2-0/+33
2021-05-11wip testsAndrew Morgan4-91/+194
2021-05-11Support fetching the spaces summary via GET over federation. (#9947)Patrick Cloke4-0/+29
Per changes in MSC2946, the C-S and S-S APIs for spaces summary should use GET requests. Until this is stable, the POST endpoints still exist. This does not switch federation requests to use the GET version yet since it is newly added and already deployed servers might not support it. When switching to the stable endpoint we should switch to GET requests.
2021-05-11Send the `m.room.create` stripped event with invites (support MSC1772). (#9966)Patrick Cloke5-5/+34
MSC1772 specifies the m.room.create event should be sent as part of the invite_state. This was done optionally behind an experimental flag, but is now done by default due to MSC1772 being approved.
2021-05-11Use link to advisory rather than to the CVE repo v1.33.2 github/release-v1.33.2 release-v1.33.2Brendan Abolivier1-1/+1
2021-05-11Add config option to hide device names over federation (#9945)Aaron Raimist4-1/+20
Now that cross signing exists there is much less of a need for other people to look at devices and verify them individually. This PR adds a config option to allow you to prevent device display names from being shared with other servers. Signed-off-by: Aaron Raimist <aaron@raim.ist>
2021-05-11 1.33.2Brendan Abolivier4-2/+23
2021-05-11Add debug logging for issue #9533 (#9959)Richard van der Hoff6-2/+42
Hopefully this will help us track down where to-device messages are getting lost/delayed.
2021-05-11Fix `m.room_key_request` to-device messages (#9961)Richard van der Hoff4-26/+32
fixes #9960
2021-05-11Merge pull request from GHSA-x345-32rc-8h85Richard van der Hoff6-68/+296
* tests for push rule pattern matching * tests for acl pattern matching * factor out common `re.escape` * Factor out common re.compile * Factor out common anchoring code * add word_boundary support to `glob_to_regex` * Use `glob_to_regex` in push rule evaluator NB that this drops support for character classes. I don't think anyone ever used them. * Improve efficiency of globs with multiple wildcards The idea here is that we compress multiple `*` globs into a single `.*`. We also need to consider `?`, since `*?*` is as hard to implement efficiently as `**`. * add assertion on regex pattern * Fix mypy * Simplify glob_to_regex * Inline the glob_to_regex helper function Signed-off-by: Dan Callahan <danc@element.io> * Moar comments Signed-off-by: Dan Callahan <danc@element.io> Co-authored-by: Dan Callahan <danc@element.io>
2021-05-10Improve performance of backfilling in large rooms. (#9935)Erik Johnston2-69/+55
We were pulling the full auth chain for the room out of the DB each time we backfilled, which can be *huge* for large rooms and is totally unnecessary.
2021-05-10Fix port_db on empty db (#9930)Richard van der Hoff6-54/+69
... and test it.
2021-05-07Always cache 'event_to_prev_state_group' (#9950)Erik Johnston2-6/+8
Fixes regression in send PDU times introduced in #9905.
2021-05-07Fix make_full_schema to create the db with the right options and user (#9931)Richard van der Hoff2-9/+11
2021-05-07Unpin attrs dep after new version has been released (#9946)Erik Johnston2-1/+2
c.f. #9936
2021-05-07Reorganise the database schema directories (#9932)Richard van der Hoff284-47/+81
The hope here is that by moving all the schema files into synapse/storage/schema, it gets a bit easier for newcomers to navigate. It certainly got easier for me to write a helpful README. There's more to do on that front, but I'll follow up with other PRs for that.
2021-05-06Export jemalloc stats to prometheus when used (#9882)Erik Johnston4-0/+200
2021-05-06Revert "Leave out optional keys from /sync (#9919)" (#9940)Erik Johnston4-51/+50
This reverts commit e9eb3549d32a6f93d07de8dbd5e1ebe54c8d8278.
2021-05-06 1.33.1 v1.33.1 github/release-v1.33.1 release-v1.33.1Erik Johnston4-2/+16
2021-05-06Pin attrs to <21.1.0 (#9937)Erik Johnston2-1/+3
Fixes #9936
2021-05-05Follow-up to #9915 to correct the identifier for room types.Patrick Cloke1-1/+1
2021-05-05Include the time of the create event in Spaces Summary. (#9928)Patrick Cloke2-0/+2
This is an update based on changes to MSC2946. The origin_server_ts of the m.room.create event is copied into the creation_ts field for each room returned from the spaces summary.
2021-05-05Increase perf of handling presence when joining large rooms. (#9916)Erik Johnston3-82/+87
2021-05-05Support stable MSC1772 spaces identifiers. (#9915)Patrick Cloke3-2/+10
Support both the unstable and stable identifiers. A future release will disable the unstable identifiers.
2021-05-05Optionally track memory usage of each LruCache (#9881)Erik Johnston8-1/+97
This will double count slightly in the presence of interned strings. It's off by default as it can consume a lot of resources.
2021-05-05Limit how often GC happens by time. (#9902)Erik Johnston6-3/+63
Synapse can be quite memory intensive, and unless care is taken to tune the GC thresholds it can end up thrashing, causing noticable performance problems for large servers. We fix this by limiting how often we GC a given generation, regardless of current counts/thresholds. This does not help with the reverse problem where the thresholds are set too high, but that should only happen in situations where they've been manually configured. Adds a `gc_min_seconds_between` config option to override the defaults. Fixes #9890.
2021-05-05Don't set the external cache if its been done recently (#9905)Erik Johnston3-5/+34
2021-05-05Use get_current_users_in_room from store and not StateHandler (#9910)Erik Johnston12-17/+26
2021-05-05Docker healthcheck timings - add startup delay and changed interval (#9913)Christopher May-Townsend3-4/+16
* Add healthcheck startup delay by 5secs and reduced interval check to 15s to reduce waiting time for docker aware edge routers bringing an instance online
2021-05-05Add presence_stream_id column to users_to_send_full_presence_to tableAndrew Morgan3-48/+43
We now return full presence in a /sync response based on the provided sync token, rather than if the user has received the response already. This is necessary in circumstances where users have more than one device - which they often do! This comment also modifies the spot in PresenceHandler where we check if the user should receive all presence. We only need to make the check if from_key is not None. If from_key is None, the user will be receiving all presence states anyways.
2021-05-05Remove users_to_send_full_presence_to table culling; add fk for user_idAndrew Morgan2-35/+12
2021-05-05Leave out optional keys from /sync (#9919)DeepBlueV7.X4-50/+51
This leaves out all optional keys from /sync. This should be fine for all clients tested against conduit already, but it may break some clients, as such we should check, that at least most of them don't break horribly and maybe back out some of the individual changes. (We can probably always leave out groups for example, while the others may cause more issues.) Signed-off-by: Nicolas Werner <nicolas.werner@hotmail.de>
2021-05-05 1.33.0 v1.33.0 github/release-v1.33.0 release-v1.33.0Brendan Abolivier4-2/+16
2021-05-04Time external cache response time (#9904)Erik Johnston2-10/+27
2021-05-04Add port parameter to the sample config for psycopg2 args (#9911)Andrew Morgan3-0/+3
Adds the `port` option with the default value to the sample config file.
2021-04-30Build Debian packages for Ubuntu 21.04 Hirsute (#9909)Dan Callahan2-3/+5
Signed-off-by: Dan Callahan <danc@element.io>
2021-04-29typo in changelog v1.33.0rc2Andrew Morgan1-1/+1
2021-04-29Add missing type hints to handlers and fix a Spam Checker type hint. (#9896)Patrick Cloke8-54/+82
The user_may_create_room_alias method on spam checkers declared the room_alias parameter as a str when in reality it is passed a RoomAlias object.
2021-04-291.33.0rc2Andrew Morgan3-2/+10
2021-04-29Delete room endpoint (#9889)ThibF5-64/+128
Support the delete of a room through DELETE request and mark previous request as deprecated through documentation. Signed-off-by: Thibault Ferrante <thibault.ferrante@pm.me>
2021-04-28Fix tight loop handling presence replication. (#9900)Erik Johnston3-1/+46
Only affects workers. Introduced in #9819. Fixes #9899.
2021-04-28Use the parent's logging context name for runWithConnection. (#9895)Patrick Cloke2-1/+4
This fixes a regression where the logging context for runWithConnection was reported as runWithConnection instead of the connection name, e.g. "POST-XYZ".
2021-04-28Reword account validity template change to sound less like a bugfix v1.33.0rc1Andrew Morgan1-1/+1
2021-04-28Reduce memory footprint of caches (#9886)Erik Johnston2-18/+60
2021-04-281.33.0rc1Andrew Morgan36-35/+54
2021-04-28Revert "Experimental Federation Speedup (#9702)"Andrew Morgan5-138/+93
This reverts commit 05e8c70c059f8ebb066e029bc3aa3e0cefef1019.
2021-04-28Add type hints to presence handler (#9885)Erik Johnston2-70/+90
2021-04-27Remove various bits of compatibility code for Python <3.6 (#9879)Andrew Morgan16-98/+29
I went through and removed a bunch of cruft that was lying around for compatibility with old Python versions. This PR also will now prevent Synapse from starting unless you're running Python 3.6+.
2021-04-27Pass errors back to the client when trying multiple federation destinations. ↵Patrick Cloke2-58/+61
(#9868) This ensures that something like an auth error (403) will be returned to the requester instead of attempting to try more servers, which will likely result in the same error, and then passing back a generic 400 error.
2021-04-27Use current state table for `presence.get_interested_remotes` (#9887)Erik Johnston2-7/+3
This should be a lot quicker than asking the state handler.
2021-04-23Improved validation for received requests (#9817)Richard van der Hoff15-31/+174
* Simplify `start_listening` callpath * Correctly check the size of uploaded files
2021-04-23Kill off `_PushHTTPChannel`. (#9878)Richard van der Hoff3-121/+20
First of all, a fixup to `FakeChannel` which is needed to make it work with the default HTTP channel implementation. Secondly, it looks like we no longer need `_PushHTTPChannel`, because as of #8013, the producer that gets attached to the `HTTPChannel` is now an `IPushProducer`. This is good, because it means we can remove a whole load of test-specific boilerplate which causes variation between tests and production.
2021-04-23Allow OIDC cookies to work on non-root public baseurls (#9726)Andrew Morgan3-9/+22
Applied a (slightly modified) patch from https://github.com/matrix-org/synapse/issues/9574. As far as I understand this would allow the cookie set during the OIDC flow to work on deployments using public baseurls that do not sit at the URL path root.
2021-04-23pass a reactor into SynapseSite (#9874)Richard van der Hoff7-24/+43
2021-04-23Add type hints to auth and auth_blocking. (#9876)Patrick Cloke4-44/+48
2021-04-23Make DomainSpecificString an attrs class (#9875)Erik Johnston4-8/+24
2021-04-23Remove room and user invite ratelimits in default unit test config (#9871)Andrew Morgan2-0/+5
2021-04-23Split presence out of master (#9820)Erik Johnston17-245/+245
2021-04-23Check for space membership during a remote join of a restricted room (#9814)Patrick Cloke6-68/+131
When receiving a /send_join request for a room with join rules set to 'restricted', check if the user is a member of the spaces defined in the 'allow' key of the join rules. This only applies to an experimental room version, as defined in MSC3083.
2021-04-23Only store data in caches, not "smart" objects (#9845)Erik Johnston3-141/+182
2021-04-23Limit the size of HTTP responses read over federation. (#9833)Richard van der Hoff4-8/+110
2021-04-22Handle all new rate limits in demo scripts (#9858)manuroe2-12/+43
2021-04-22Limit length of accepted email addresses (#9855)Erik Johnston6-7/+100
2021-04-22Clear the resync bit after resyncing device lists (#9867)Richard van der Hoff3-10/+17
Fixes #9866.
2021-04-22Remove `synapse.types.Collection` (#9856)Richard van der Hoff26-62/+77
This is no longer required, since we have dropped support for Python 3.5.
2021-04-22A regression can't be introduced twice v1.32.2 github/release-v1.32.2 release-v1.32.2Andrew Morgan1-2/+2
2021-04-22Note regression was in 1.32.0 and 1.32.1Andrew Morgan1-2/+2
2021-04-21Update dates in changelogsAndrew Morgan2-2/+2
2021-04-211.32.2Andrew Morgan4-2/+18
2021-04-21Note LoggingContext signature change incompatibility in 1.32.0 (#9859) github/release-v1.32.1 release-v1.32.1Andrew Morgan2-9/+16
1.32.0 also introduced an incompatibility with Synapse modules that make use of `synapse.logging.context.LoggingContext`, such as [synapse-s3-storage-provider](https://github.com/matrix-org/synapse-s3-storage-provider). This PR adds a note to the 1.32.0 changelog and upgrade notes about it.
2021-04-21Make LoggingContext's name optional (#9857)Richard van der Hoff2-3/+13
Fixes https://github.com/matrix-org/synapse-s3-storage-provider/issues/55
2021-04-21Clarify 1.32.0/1 changelog and upgrade notes v1.32.1Andrew Morgan2-8/+7
2021-04-21Add regression notes to CHANGES.md; fix link in 1.32.0 changelogAndrew Morgan1-2/+6
2021-04-21Add link to fixing prometheus to 1.32.0 upgrade notes; 1.32.1 has a fixAndrew Morgan2-2/+6
2021-04-21Fix typo in link to regression in 1.32.0 upgrade notesAndrew Morgan1-1/+1
2021-04-211.32.1Andrew Morgan4-2/+16
2021-04-21Mention Prometheus metrics regression in v1.32.0Andrew Morgan2-0/+15
2021-04-21Stop BackgroundProcessLoggingContext making new prometheus timeseries (#9854)Richard van der Hoff3-5/+18
This undoes part of b076bc276e881b262048307b6a226061d96c4a8d.
2021-04-20Rename handler and config modules which end in handler/config. (#9816)Patrick Cloke17-35/+43
2021-04-20Mention Prometheus metrics regression in v1.32.0 github/release-v1.32.0 release-v1.32.0Andrew Morgan2-0/+15
2021-04-20Further tweaking on gpg signing key noticeAndrew Morgan1-2/+5
2021-04-20Add note about expired Debian gpg signing keys to CHANGES.mdAndrew Morgan1-0/+6
2021-04-20Update v1.32.0 changelog. It's m.login.application_service, not plural v1.32.0Andrew Morgan1-1/+1
2021-04-20 1.32.0Andrew Morgan4-6/+18
2021-04-20Add Application Service registration type requirement + py35, pg95 ↵Andrew Morgan1-0/+18
deprecation notices to v1.32.0 upgrade notes (#9849) Fixes https://github.com/matrix-org/synapse/issues/9846. Adds important removal information from the top of https://github.com/matrix-org/synapse/releases/tag/v1.32.0rc1 into UPGRADE.rst.
2021-04-20Always use the name as the log ID. (#9829)Patrick Cloke8-34/+26
As far as I can tell our logging contexts are meant to log the request ID, or sometimes the request ID followed by a suffix (this is generally stored in the name field of LoggingContext). There's also code to log the name@memory location, but I'm not sure this is ever used. This simplifies the code paths to require every logging context to have a name and use that in logging. For sub-contexts (created via nested_logging_contexts, defer_to_threadpool, Measure) we use the current context's str (which becomes their name or the string "sentinel") and then potentially modify that (e.g. add a suffix).
2021-04-20Add presence federation stream (#9819)Erik Johnston6-31/+426
2021-04-20Fix bug where we sent remote presence states to remote servers (#9850)Erik Johnston3-3/+13
2021-04-20Fix (final) Bugbear violations (#9838)Jonathan de Jong23-49/+46
2021-04-19