summary refs log tree commit diff
path: root/synapse (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #3607 from matrix-org/rav/fix_persist_events_integrity_errorRichard van der Hoff2018-07-251-1/+1
|\ | | | | Fix occasional 'tuple index out of range' error
| * Fix occasional 'tuple index out of range' errorRichard van der Hoff2018-07-251-1/+1
| | | | | | | | | | | | | | This fixes a bug in _delete_existing_rows_txn which was introduced in #3435 (though it's been on matrix-org-hotfixes for *years*). This code is only called when there is some sort of conflict the first time we try to persist an event, so it only happens rarely. Still, the exceptions are annoying.
* | Merge pull request #3605 from matrix-org/rav/fix_update_remote_profile_cacheRichard van der Hoff2018-07-251-1/+8
|\ \ | | | | | | Fix updating of cached remote profiles
| * | Fix updating of cached remote profilesRichard van der Hoff2018-07-251-1/+8
| |/ | | | | | | | | | | _update_remote_profile_cache was missing its `defer.inlineCallbacks`, so when it was called, would just return a generator object, without actually running any of the method body.
* | Fix unit testsRichard van der Hoff2018-07-251-1/+1
| | | | | | | | | | | | on_notifier_poke no longer runs synchonously, so we have to do a different hack to make sure that the replication data has been sent. Let's actually listen for its arrival.
* | Wrap a number of things that run in the backgroundRichard van der Hoff2018-07-259-22/+63
|/ | | | | This will reduce the number of "Starting db connection from sentinel context" warnings, and will help with our metrics.
* Replace usage of get_current_toke with StreamToken.STARTErik Johnston2018-07-242-5/+9
| | | | | | | | This allows us to handle /context/ requests on the client_reader worker without having to pull in all the various stream handlers (e.g. precence, typing, pushers etc). The only thing the token gets used for is pagination, and that ignores everything but the room portion of the token.
* Pull out did_forget to worker storeErik Johnston2018-07-242-29/+28
|
* Merge pull request #3595 from matrix-org/erikj/use_deltasErik Johnston2018-07-241-53/+118
|\ | | | | Use deltas to calculate current state deltas
| * Expand on docstring comment about return valueErik Johnston2018-07-241-0/+5
| |
| * Remove unnecessary iteritemsErik Johnston2018-07-241-1/+1
| |
| * Fixup comment (and indent)Erik Johnston2018-07-241-16/+20
| |
| * Don't fetch state from the database unless neededErik Johnston2018-07-241-12/+18
| |
| * Have _get_new_state_after_events return deltaErik Johnston2018-07-241-17/+48
| | | | | | | | | | | | If we have a delta from the existing to new current state, then we can reuse that rather than manually working it out by fetching both lots of state.
| * Don't require to_delete to have event_idsErik Johnston2018-07-241-36/+55
| |
* | Merge pull request #3587 from matrix-org/rav/better_exception_loggingRichard van der Hoff2018-07-241-3/+8
|\ \ | | | | | | Improve logging for exceptions when handling PDUs
| * | Improve logging for exceptions handling PDUsRichard van der Hoff2018-07-231-3/+8
| | | | | | | | | | | | when we get an exception handling a federation PDU, log the whole stacktrace.
* | | Merge pull request #3586 from matrix-org/rav/optimise_resolve_state_groupsRichard van der Hoff2018-07-243-62/+97
|\ \ \ | | | | | | | | Fixes and optimisations for resolve_state_groups
| * | | Handle delta_ids being None in _update_context_for_auth_eventsRichard van der Hoff2018-07-232-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | it's easier to create the new state group as a delta from the existing one. (There's an outside chance this will help with https://github.com/matrix-org/synapse/issues/3364)
| * | | Fixes and optimisations for resolve_state_groupsRichard van der Hoff2018-07-231-54/+89
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First of all, fix the logic which looks for identical input state groups so that we actually use them. This turned out to be most easily done by factoring the relevant code out to a separate function so that we could do an early return. Secondly, avoid building the whole `conflicted_state` dict (which was only ever used as a boolean flag). Thirdly, replace the construction of the `state` dict (which mapped from keys to events that set them), with an optimistic construction of the resolution result assuming there will be no conflicts. This should be no slower than building the old `state` dict, and: - in the conflicted case, we'll short-cut it, saving part of the work - in the unconflicted case, it saves rebuilding the resolution from the `state` dict. Finally, do a couple of s/values/itervalues/.
* | | Merge pull request #3583 from matrix-org/rav/remove_who_forgot_in_roomRichard van der Hoff2018-07-243-46/+1
|\ \ \ | |_|/ |/| | Remove redundant checks on room forgottenness
| * | Merge remote-tracking branch 'origin/develop' into rav/remove_who_forgot_in_roomRichard van der Hoff2018-07-2414-317/+429
| |\ \
| * \ \ Merge remote-tracking branch 'origin/develop' into rav/remove_who_forgot_in_roomRichard van der Hoff2018-07-2319-179/+400
| |\ \ \
| * | | | Remove redundant checks on room forgottennessRichard van der Hoff2018-07-233-46/+1
| | | | | | | | | | | | | | | | | | | | Fixes #3550
* | | | | Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2018-07-2413-315/+408
|\ \ \ \ \ | | |_|/ / | |/| | | | | | | | erikj/speed_up_calculate_state_delta
| * | | | Merge branch 'develop' into rav/logcontext_fixesRichard van der Hoff2018-07-2410-295/+380
| |\ \ \ \
| | * \ \ \ Merge pull request #3555 from matrix-org/erikj/client_apis_moveErik Johnston2018-07-249-284/+359
| | |\ \ \ \ | | | | | | | | | | | | | | Make client_reader support some more read only APIs
| | | * \ \ \ Merge branch 'develop' into erikj/client_apis_moveErik Johnston2018-07-2412-126/+305
| | | |\ \ \ \ | | | | | |_|/ | | | | |/| |
| | | * | | | Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2018-07-2333-223/+683
| | | |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | erikj/client_apis_move
| | | * | | | | Move PaginationHandler to its own fileErik Johnston2018-07-203-245/+269
| | | | | | | |
| | | * | | | | Move check_in_room_or_world_readable to AuthErik Johnston2018-07-202-34/+40
| | | | | | | |
| | | * | | | | Add some room read only APIs to client_readerErik Johnston2018-07-181-1/+13
| | | | | | | |
| | | * | | | | Move RoomContextHandler out of HandlersErik Johnston2018-07-184-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is in preparation for moving GET /context/ to a worker
| | | * | | | | Split MessageHandler into read only and writersErik Johnston2018-07-185-149/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will let us call the read only parts from workers, and so be able to move some APIs off of master, e.g. the `/state` API.
| | * | | | | | fix idiocyRichard van der Hoff2018-07-241-2/+8
| | | | | | | |
| | * | | | | | Add some measure blocks to persist_eventsRichard van der Hoff2018-07-231-11/+15
| | | |_|/ / / | | |/| | | | | | | | | | | | | | | | | | ... to help us figure out where 40% of CPU is going
| * | | | | | another couple of logcontext leaksRichard van der Hoff2018-07-242-5/+10
| | | | | | |
| * | | | | | Logcontext fixesRichard van der Hoff2018-07-243-16/+19
| |/ / / / / | | | | | | | | | | | | | | | | | | Fix some random logcontext leaks.
* | | | | | Remove unnecessary ifErik Johnston2018-07-241-2/+1
| | | | | |
* | | | | | Speed up _calculate_state_deltaErik Johnston2018-07-241-10/+3
|/ / / / /
* | | | | CommentsErik Johnston2018-07-232-2/+6
| | | | |
* | | | | Only get cached state from context in persist_eventErik Johnston2018-07-232-1/+16
| |_|_|/ |/| | | | | | | | | | | | | | | | | | | We don't want to bother pulling out the current state from the DB since until we know we have to. Checking the context for state is just an optimisation.
* | | | Fix missing attributes on workers.Erik Johnston2018-07-233-8/+14
| | | | | | | | | | | | | | | | | | | | This was missed during the transition from attribute to getter for getting state from context.
* | | | Fix EventContext when using workersErik Johnston2018-07-231-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | We were: 1. Not correctly setting all attributes 2. Using defer.inlineCallbacks in a non-generator
* | | | Update docstrings to make senseErik Johnston2018-07-231-5/+8
| | | |
* | | | Add support for updating stateErik Johnston2018-07-232-9/+42
| | | |
* | | | Use new gettersErik Johnston2018-07-239-31/+59
| | | |
* | | | Make EventContext lazy load stateErik Johnston2018-07-232-44/+115
| | | |
* | | | pep8Erik Johnston2018-07-231-1/+1
| | | |
* | | | Refcator EventContext to accept state during initErik Johnston2018-07-232-63/+82
| |/ / |/| |
* | | Merge branch 'develop' into matthew/sync_deleted_devicesMatthew Hodgson2018-07-2356-672/+1056
|\ \ \
| * | | Make the rest of the .iterwhatever go away (#3562)Amber Brown2018-07-216-25/+32
| | | |
| * | | Test and fix support for cancellation in LinearizerRichard van der Hoff2018-07-201-6/+22
| | |/ | |/|
| * | Merge pull request #3571 from matrix-org/rav/limiter_fixesRichard van der Hoff2018-07-202-94/+39
| |\ \ | | | | | | | | A set of improvements to the Limiter
| | * | Combine Limiter and LinearizerRichard van der Hoff2018-07-202-91/+12
| | | | | | | | | | | | | | | | | | | | Linearizer was effectively a Limiter with max_count=1, so rather than maintaining two sets of code, let's combine them.
| | * | Improvements to the LimiterRichard van der Hoff2018-07-202-14/+21
| | | | | | | | | | | | | | | | | | | | * give them names, to improve logging * use a deque rather than a list for efficiency
| | * | Add a sleep to the Limiter to fix stack overflows.Richard van der Hoff2018-07-201-3/+20
| | | | | | | | | | | | | | | | Fixes #3570
| * | | Admin API for creating new users (#3415)Amber Brown2018-07-203-0/+169
| |/ /
| * | Merge branch 'master' into developAmber Brown2018-07-191-1/+1
| |\ \
| | * | 0.33 finalAmber Brown2018-07-191-1/+1
| | | |
| * | | Don't spew errors because we can't save metrics (#3563)Amber Brown2018-07-192-6/+24
| | | |
| * | | revert 00bc979Richard van der Hoff2018-07-191-4/+3
| | | | | | | | | | | | | | | | | | | | ... we've fixed the things that caused the warnings, so we should reinstate the warning.
| * | | Merge remote-tracking branch 'origin/release-v0.33.0' into developRichard van der Hoff2018-07-192-4/+5
| |\| |
| | * | Disable logcontext warningRichard van der Hoff2018-07-191-3/+4
| | | | | | | | | | | | | | | | Temporary workaround to #3518 while we release 0.33.0.
| | * | bump to 0.33.0rc1Amber Brown2018-07-181-1/+1
| | | |
| * | | Merge pull request #3556 from matrix-org/rav/background_processesRichard van der Hoff2018-07-197-52/+62
| |\ \ \ | | | | | | | | | | Run things as background processes
| | * | | Make Distributor run its processes as a background processRichard van der Hoff2018-07-181-26/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is more involved than it might otherwise be, because the current implementation just drops its logcontexts and runs everything in the sentinel context. It turns out that we aren't actually using a bunch of the functionality here (notably suppress_failures and the fact that Distributor.fire returns a deferred), so the easiest way to fix this is actually by simplifying a bunch of code.
| | * | | Run things as background processesRichard van der Hoff2018-07-187-26/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes #3518, and ensures that we get useful logs and metrics for lots of things that happen in the background. (There are certainly more things that happen in the background; these are just the common ones I've found running a single-process synapse locally).
| * | | | Move v1-only APIs into their own module & isolate deprecated ones (#3460)Amber Brown2018-07-196-15/+88
| | | | |
| * | | | Merge pull request #3554 from matrix-org/erikj/response_metrics_codeErik Johnston2018-07-191-3/+6
| |\ \ \ \ | | |/ / / | |/| | | Add response code to response timer metrics
| | * | | pep8Erik Johnston2018-07-181-1/+2
| | | | |
| | * | | Add response code to response timer metricsErik Johnston2018-07-181-3/+5
| | | |/ | | |/|
| * | | Merge pull request #3553 from matrix-org/rav/background_process_trackingRichard van der Hoff2018-07-182-5/+186
| |\ \ \ | | |/ / | |/| | Resource tracking for background processes
| | * | Resource tracking for background processesRichard van der Hoff2018-07-182-5/+186
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces a mechanism for tracking resource usage by background processes, along with an example of how it will be used. This will help address #3518, but more importantly will give us better insights into things which are happening but not being shown up by the request metrics. We *could* do this with Measure blocks, but: - I think having them pulled out as a completely separate metric class will make it easier to distinguish top-level processes from those which are nested. - I want to be able to report on in-flight background processes, and I don't think we want to do this for *all* Measure blocks.
| * | Merge pull request #3367 from matrix-org/rav/drop_re_signing_hacksRichard van der Hoff2018-07-181-43/+0
| |\ \ | | | | | | | | Remove event re-signing hacks
| | * \ Merge branch 'develop' into rav/drop_re_signing_hacksRichard van der Hoff2018-07-04101-571/+1178
| | |\ \
| | * | | Remove event re-signing hacksRichard van der Hoff2018-06-071-43/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These "temporary fixes" have been here three and a half years, and I can't find any events in the matrix.org database where the calculated signature differs from what's in the db. It's time for them to go away.
| * | | | Merge pull request #3514 from matrix-org/dbkr/turn_dont_add_defaultsDavid Baker2018-07-181-2/+2
| |\ \ \ \ | | |_|_|/ | |/| | | Comment dummy TURN parameters in default config
| | * | | Comment dummy TURN parameters in default configDavid Baker2018-07-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This default config is parsed and used a base before the actual config is overlaid, so with these values not commented out, the code to detect when no turn params were set and refuse to generate credentials was never firing because the dummy default was always set.
| * | | | add a commentRichard van der Hoff2018-07-171-0/+2
| | | | |
| * | | | Fix visibility of events from erased users over federationRichard van der Hoff2018-07-171-56/+67
| | | | |
| * | | | Merge pull request #3541 from matrix-org/rav/optimize_filter_events_for_serverRichard van der Hoff2018-07-172-138/+147
| |\ \ \ \ | | | | | | | | | | | | Refactor and optimze filter_events_for_server
| | * | | | fix importsRichard van der Hoff2018-07-171-0/+1
| | | | | |
| | * | | | add a commentRichard van der Hoff2018-07-171-0/+2
| | | | | |
| | * | | | Attempt to make _filter_events_for_server more efficientRichard van der Hoff2018-07-161-17/+23
| | | | | |
| | * | | | Move filter_events_for_server out of FederationHandlerRichard van der Hoff2018-07-162-138/+138
| | | | | | | | | | | | | | | | | | | | | | | | for easier unit testing.
| * | | | | Refactor REST API tests to use explicit reactors (#3351)Amber Brown2018-07-172-3/+4
| | | | | |
| * | | | | Use efficient .intersectionErik Johnston2018-07-171-4/+1
| | | | | |
| * | | | | Fix perf regression in PR #3530Erik Johnston2018-07-171-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The get_entities_changed function was changed to return all changed entities since the given stream position, rather than only those changed from a given list of entities. This resulted in the function incorrectly returning large numbers of entities that, for example, caused large increases in database usage.
| * | | | | Merge pull request #3530 from matrix-org/erikj/stream_cacheAmber Brown2018-07-171-8/+1
| |\ \ \ \ \ | | | | | | | | | | | | | | Don't return unknown entities in get_entities_changed
| | * | | | | Don't return unknown entities in get_entities_changedErik Johnston2018-07-131-8/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The stream cache keeps track of all entities that have changed since a particular stream position, so get_entities_changed does not need to return unknown entites when given a larger stream position. This makes it consistent with the behaviour of has_entity_changed.
| * | | | | | rerun isort with latest versionKrombel2018-07-166-20/+4
| | | | | | |
| * | | | | | check isort by travisKrombel2018-07-1611-11/+27
| | | | | | |
| * | | | | | Fix develop because I broke it :( (#3535)Amber Brown2018-07-142-2/+5
| | | | | | |
| * | | | | | Merge pull request #3534 from krombel/use_parse_and_asserts_from_servletAmber Brown2018-07-1417-165/+101
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | Use parse and asserts from http.servlet
| | * | | | | | fix sytestsAmber Brown2018-07-141-1/+1
| | | | | | | |
| | * | | | | | add changelogKrombel2018-07-131-1/+1
| | | | | | | |
| | * | | | | | rename assert_params_in_request to assert_params_in_dictKrombel2018-07-1311-33/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the method "assert_params_in_request" does handle dicts and not requests. A request body has to be parsed to json before this method can be used
| | * | | | | | Use parse_{int,str} and assert from http.servletKrombel2018-07-1314-155/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | parse_integer and parse_string can take a request and raise errors in case we have wrong or missing params. This PR tries to use them more to deduplicate some code and make it better readable
| * | | | | | | Make auth & transactions more testable (#3499)Amber Brown2018-07-148-97/+93
| |/ / / / / /
| * | | | | | Merge pull request #3533 from matrix-org/rav/fix_federation_ratelimite_queueRichard van der Hoff2018-07-131-10/+23
| |\ \ \ \ \ \ | | |/ / / / / | |/| | | | | Make FederationRateLimiter queue requests properly
| | * | | | | Make FederationRateLimiter queue requests properlyRichard van der Hoff2018-07-131-10/+23
| | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | popitem removes the *most recent* item by default [1]. We want the oldest. Fixes #3524 [1]: https://docs.python.org/2/library/collections.html#collections.OrderedDict.popitem
| * / / / / typoMatthew Hodgson2018-07-131-3/+3
| |/ / / /
| * | | | Merge pull request #3521 from matrix-org/rav/optimise_stream_change_cacheRichard van der Hoff2018-07-121-8/+12
| |\ \ \ \ | | | | | | | | | | | | Reduce set building in get_entities_changed
| | * | | | Reduce set building in get_entities_changedRichard van der Hoff2018-07-121-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This line shows up as about 5% of cpu time on a synchrotron: not_known_entities = set(entities) - set(self._entity_to_key) Presumably the problem here is that _entity_to_key can be largeish, and building a set for its keys every time this function is called is slow. Here we rewrite the logic to avoid building so many sets.
| * | | | | Merge branch 'develop' into rav/enforce_report_apiRichard van der Hoff2018-07-12270-2247/+3387
| |\| | | |
| | * | | | Merge pull request #3505 from matrix-org/erikj/receipts_cahceErik Johnston2018-07-122-7/+20
| | |\ \ \ \ | | | |/ / / | | |/| | | Use stream cache in get_linearized_receipts_for_room
| | | * | | Update return value docstringErik Johnston2018-07-121-1/+1
| | | | | |
| | | * | | Use 'is not None' and add commentsErik Johnston2018-07-101-2/+6
| | | | | |
| | | * | | Use stream cache in get_linearized_receipts_for_roomErik Johnston2018-07-102-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids us from uncessarily hitting the database when there has been no change for the room
| * | | | | Enforce the specified API for report_eventRichard van der Hoff2018-05-311-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | as per https://matrix.org/docs/spec/client_server/unstable.html#post-matrix-client-r0-rooms-roomid-report-eventid
* | | | | | add trailing commaMatthew Hodgson2018-07-231-1/+1
| | | | | |
* | | | | | yes, we do need to invalidate the device_id_exists_cache when deleting a ↵Matthew Hodgson2018-07-191-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | remote device
* | | | | | spell out that include_deleted_devices requires include_all_devicesMatthew Hodgson2018-07-191-1/+5
| | | | | |
* | | | | | shift to using an explicit deleted flag on m.device_list_update EDUsMatthew Hodgson2018-07-122-20/+25
| | | | | | | | | | | | | | | | | | | | | | | | and generally make it work.
* | | | | | WIP to announce deleted devices over federationMatthew Hodgson2018-07-123-14/+44
| |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | Previously we queued up the poke correctly when the device was deleted, but then the actual EDU wouldn't get sent, as the device was no longer known. Instead, we now send EDUs for deleted devices too if there's a poke for them.
* | | | | s/becuase/because/gMatthew Hodgson2018-07-103-4/+4
| |/ / / |/| | |
* | | | Attempt to include db threads in cpu usage stats (#3496)Richard van der Hoff2018-07-103-20/+38
| | | | | | | | | | | | | | | | | | | | Let's try to include time spent in the DB threads in the per-request/block cpu usage metrics.
* | | | Refactor logcontext resource usage tracking (#3501)Richard van der Hoff2018-07-104-130/+146
| | | | | | | | | | | | | | | | | | | | Factor out the resource usage tracking out to a separate object, which can be passed around and copied independently of the logcontext itself.
* | | | another typoMatthew Hodgson2018-07-101-1/+1
| | | |
* | | | typo (i think)Matthew Hodgson2018-07-101-1/+1
| | | |
* | | | Add CPU metrics for _fetch_event_listRichard van der Hoff2018-07-091-19/+32
| | | | | | | | | | | | | | | | | | | | add a Measure block on _fetch_event_list, in the hope that we can better measure CPU usage here.
* | | | run isortAmber Brown2018-07-09258-1312/+1336
| | | |
* | | | versionAmber Brown2018-07-071-1/+1
| | | |
* | | | Correct attrs package name in requirements (#3492)Amber Brown2018-07-071-1/+1
| | | |
* | | | Prepare 0.32.1 release v0.32.1 github/release-v0.32.1 release-v0.32.1Richard van der Hoff2018-07-061-1/+1
| | | |
* | | | Add explicit dependency on netaddrRichard van der Hoff2018-07-061-3/+1
| | | | | | | | | | | | | | | | | | | | the dependencies file, causing failures on upgrade (and presumably for new installs).
* | | | 0.32.0 version bump, update changelog v0.32.0 github/release-v0.32.0 release-v0.32.0Neil Johnson2018-07-061-1/+1
| | | |
* | | | bump version to 0.32.0rc1Amber Brown2018-07-051-1/+1
| | | |
* | | | Implementation of server_aclsRichard van der Hoff2018-07-043-4/+156
| | | | | | | | | | | | | | | | | | | | ... as described at https://docs.google.com/document/d/1EttUVzjc2DWe2ciw4XPtNpUpIl9lWXGEsy2ewDS7rtw.
* | | | More server_name validationRichard van der Hoff2018-07-043-9/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to do a bit more validation when we get a server name, but don't want to be re-doing it all over the shop, so factor out a separate parse_and_validate_server_name, and do the extra validation. Also, use it to verify the server name in the config file.
* | | | Merge pull request #3473 from matrix-org/erikj/thread_cacheErik Johnston2018-07-041-1/+2
|\ \ \ \ | | | | | | | | | | Invalidate cache on correct thread
| * | | | Invalidate cache on correct threadErik Johnston2018-07-021-1/+2
| | | | |
* | | | | Merge pull request #3474 from matrix-org/erikj/py3_authErik Johnston2018-07-041-1/+6
|\ \ \ \ \ | |_|_|_|/ |/| | | | Fix up auth check
| * | | | Avoid relying on int vs None comparisonErik Johnston2018-07-021-1/+5
| | | | | | | | | | | | | | | | | | | | Python 3 doesn't support comparing None to ints
| * | | | Ensure that we define sender_domainErik Johnston2018-07-021-0/+1
| |/ / /
* | | | Reject invalid server names (#3480)Richard van der Hoff2018-07-032-25/+75
| | | | | | | | | | | | | | | | | | | | Make sure that server_names used in auth headers are sane, and reject them with a sensible error code, before they disappear off into the depths of the system.
* | | | replace invalid utf8 with \ufffdMatthew Hodgson2018-07-021-2/+2
| | | |
* | | | a fix which doesn't NPE everywhereMatthew Hodgson2018-07-011-9/+17
| | | |
* | | | don't mix unicode strings with utf8-in-byte-stringsMatthew Hodgson2018-07-011-2/+9
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | otherwise we explode with: ``` Traceback (most recent call last): File /usr/lib/python2.7/logging/handlers.py, line 78, in emit logging.FileHandler.emit(self, record) File /usr/lib/python2.7/logging/__init__.py, line 950, in emit StreamHandler.emit(self, record) File /usr/lib/python2.7/logging/__init__.py, line 887, in emit self.handleError(record) File /usr/lib/python2.7/logging/__init__.py, line 810, in handleError None, sys.stderr) File /usr/lib/python2.7/traceback.py, line 124, in print_exception _print(file, 'Traceback (most recent call last):') File /usr/lib/python2.7/traceback.py, line 13, in _print file.write(str+terminator) File /home/matrix/.synapse/local/lib/python2.7/site-packages/twisted/logger/_io.py, line 170, in write self.log.emit(self.level, format=u{log_io}, log_io=line) File /home/matrix/.synapse/local/lib/python2.7/site-packages/twisted/logger/_logger.py, line 144, in emit self.observer(event) File /home/matrix/.synapse/local/lib/python2.7/site-packages/twisted/logger/_observer.py, line 136, in __call__ errorLogger = self._errorLoggerForObserver(brokenObserver) File /home/matrix/.synapse/local/lib/python2.7/site-packages/twisted/logger/_observer.py, line 156, in _errorLoggerForObserver if obs is not observer File /home/matrix/.synapse/local/lib/python2.7/site-packages/twisted/logger/_observer.py, line 81, in __init__ self.log = Logger(observer=self) File /home/matrix/.synapse/local/lib/python2.7/site-packages/twisted/logger/_logger.py, line 64, in __init__ namespace = self._namespaceFromCallingContext() File /home/matrix/.synapse/local/lib/python2.7/site-packages/twisted/logger/_logger.py, line 42, in _namespaceFromCallingContext return currentframe(2).f_globals[__name__] File /home/matrix/.synapse/local/lib/python2.7/site-packages/twisted/python/compat.py, line 93, in currentframe for x in range(n + 1): RuntimeError: maximum recursion depth exceeded while calling a Python object Logged from file site.py, line 129 File /usr/lib/python2.7/logging/__init__.py, line 859, in emit msg = self.format(record) File /usr/lib/python2.7/logging/__init__.py, line 732, in format return fmt.format(record) File /usr/lib/python2.7/logging/__init__.py, line 471, in format record.message = record.getMessage() File /usr/lib/python2.7/logging/__init__.py, line 335, in getMessage msg = msg % self.args UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 4: ordinal not in range(128) Logged from file site.py, line 129 ``` ...where the logger apparently recurses whilst trying to log the error, hitting the maximum recursion depth and killing everything badly.
* | | Merge pull request #3456 from matrix-org/hawkowl/federation-prevevent-checkingErik Johnston2018-06-292-29/+71
|\ \ \ | | | | | | | | Check the state of prev_events a bit more thoroughly when coming over federation
| * | | try and clean upAmber Brown2018-06-271-3/+6
| | | |
| * | | pep8Amber Brown2018-06-271-6/+4
| | | |
| * | | cleanupsAmber Brown2018-06-271-13/+15
| | | |
| * | | handle federation not telling us about prev_eventsAmber Brown2018-06-272-26/+65
| | | |
* | | | fix testsMatthew Hodgson2018-06-281-0/+1
| | | |
* | | | add ip_range_whitelist parameter to limit where ASes can connect fromMatthew Hodgson2018-06-283-2/+19
| | | |
* | | | Attempt to be more performant on PyPy (#3462)Amber Brown2018-06-2839-62/+78
| | | |
* | | | Revert "Revert "Try to not use as much CPU in the StreamChangeCache"" (#3454)Amber Brown2018-06-281-2/+4
|/ / /
* | | Revert "Try to not use as much CPU in the StreamChangeCache"Matthew Hodgson2018-06-261-4/+2
| | |
* | | Merge pull request #3451 from matrix-org/hawkowl/sorteddict-apiMatthew Hodgson2018-06-261-2/+4
|\ \ \ | | | | | | | | Try to not use as much CPU in the cache
| * | | fixesAmber Brown2018-06-261-2/+2
| | | |
| * | | fixesAmber Brown2018-06-261-2/+2
| | | |
| * | | try and make loading items from the cache fasterAmber Brown2018-06-261-2/+4
| | | |
* | | | Fix error on deleting users pending deactivationDavid Baker2018-06-261-1/+3
| | | | | | | | | | | | | | | | Use simple_delete instead of simple_delete_one as commented
* | | | Merge pull request #3448 from matrix-org/matthew/gdpr-deactivate-admin-apiMatthew Hodgson2018-06-262-1/+13
|\ \ \ \ | |/ / / |/| | | add GDPR erase param to deactivate API
| * | | update doc for deactivate APIMatthew Hodgson2018-06-261-1/+1
| | | |
| * | | add GDPR erase param to deactivate APIMatthew Hodgson2018-06-262-1/+13
| | | |
* | | | Merge pull request #3438 from turt2live/travis/dont-print-access-tokens-in-logsAmber Brown2018-06-261-2/+2
|\ \ \ \ | | | | | | | | | | Stop including access tokens in warnings in the log
| * | | | Don't print invalid access tokens in the logsTravis Ralston2018-06-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Tokens shouldn't be appearing the logs, valid or invalid. Signed-off-by: Travis Ralston <travpc@gmail.com>
* | | | | Merge pull request #3442 from matrix-org/matthew/allow-unconsented-partsErik Johnston2018-06-251-2/+6
|\ \ \ \ \ | | | | | | | | | | | | allow non-consented users to still part rooms (to let us autopart them)
| * | | | | allow non-consented users to still part rooms (to let us autopart them)Matthew Hodgson2018-06-251-2/+6
| | |/ / / | |/| | |
* | | | | Actually fix itErik Johnston2018-06-251-3/+3
| | | | |
* | | | | CommentErik Johnston2018-06-251-0/+8
| | | | |
* | | | | Fix bug with assuming wrong typeErik Johnston2018-06-251-2/+2
| | | | |
* | | | | Add fast path to _filter_events_for_serverErik Johnston2018-06-251-1/+34
|/ / / / | | | | | | | | | | | | | | | | | | | | Most rooms have a trivial history visibility like "shared" or "world_readable", especially large rooms, so lets not bother getting the full membership of those rooms in that case.
* | | | typosMatthew Hodgson2018-06-251-1/+1
| | | |
* | | | typoMatthew Hodgson2018-06-251-1/+1
| | | |
* | | | Need to pass reactor to endpoint facErik Johnston2018-06-251-1/+1
| | | |
* | | | Merge pull request #3441 from matrix-org/erikj/redo_erasureErik Johnston2018-06-259-26/+216
|\ \ \ \ | | | | | | | | | | Fix user erasure and re-enable
| * | | | Add UserErasureWorkerStore to workersErik Johnston2018-06-251-0/+2
| | | | |
| * | | | Revert "Revert "Merge pull request #3431 from ↵Erik Johnston2018-06-258-26/+214
| |/ / / | | | | | | | | | | | | | | | | | | | | matrix-org/rav/erasure_visibility"" This reverts commit 1d009013b3c3e814177afc59f066e02a202b21cd.
* / / / Remove all global reactor imports & pass it around explicitly (#3424)Amber Brown2018-06-259-22/+29
|/ / /
* | | Revert "Merge pull request #3431 from matrix-org/rav/erasure_visibility"Richard van der Hoff2018-06-228-214/+26
| | | | | | | | | | | | | | | This reverts commit ce0d911156b355c5bf452120bfb08653dad96497, reversing changes made to b4a5d767a94f1680d07edfd583aae54ce422573e.
* | | Merge pull request #3435 from matrix-org/rav/fix_event_push_actions_tablescanRichard van der Hoff2018-06-221-1/+8
|\ \ \ | | | | | | | | Fix event_push_actions tablescan when reinserting events
| * | | Deleting from event_push_actions needs to use an indexMark Haines2018-06-221-1/+8
| | | |
* | | | Also log number of events for serach contextErik Johnston2018-06-221-0/+5
| | | |
* | | | Add some logging to search queriesErik Johnston2018-06-221-0/+9
|/ / /
* | | Merge pull request #3432 from matrix-org/rav/joined_hosts_cache_non_iterableRichard van der Hoff2018-06-221-1/+1
|\ \ \ | | | | | | | | Make _get_joined_hosts_cache cache non-iterable
| * | | Make _get_joined_hosts_cache cache non-iterableErik Johnston2018-06-221-1/+1
| | | |
* | | | Merge pull request #3430 from matrix-org/rav/configurable_push_action_rotationRichard van der Hoff2018-06-221-3/+5
|\ \ \ \ | |/ / / |/| | | Make push actions rotation configurable
| * | | Make push actions rotation configurableErik Johnston2018-06-221-3/+5
| | | |
* | | | Merge pull request #3431 from matrix-org/rav/erasure_visibilityErik Johnston2018-06-228-26/+214
|\ \ \ \ | | | | | | | | | | Support hiding events from deleted users
| * | | | Filter out erased messagesRichard van der Hoff2018-06-122-22/+68
| | | | | | | | | | | | | | | | | | | | Redact any messges sent by erased users.
| * | | | mark accounts as erased when requestedRichard van der Hoff2018-06-123-4/+20
| | | | |
| * | | | UserErasureStoreRichard van der Hoff2018-06-123-0/+126
| | | | | | | | | | | | | | | | | | | | to store which users have been erased
* | | | | Merge pull request #3428 from matrix-org/erikj/persisted_pduErik Johnston2018-06-222-30/+27
|\| | | | | | | | | | | | | | Simplify get_persisted_pdu
| * | | | simplify get_persisted_pduRichard van der Hoff2018-06-122-30/+27
| | | | | | | | | | | | | | | | | | | | | | | | | it doesn't make much sense to use get_persisted_pdu on the receive path: just get the event straight from the store.
* | | | | Merge pull request #3427 from matrix-org/erikj/remove_filtersErik Johnston2018-06-222-84/+35
|\| | | | | |/ / / |/| | | remove dead filter_events_for_clients
| * | | remove dead filter_events_for_clientsRichard van der Hoff2018-06-122-84/+35
| | | | | | | | | | | | | | | | | | | | | | | | This is only used by filter_events_for_client, so we can simplify the whole thing by just doing one user at a time, and removing a dead storage function to boot.
* | | | Disable partial state group caching for wildcard lookupsRichard van der Hoff2018-06-222-26/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When _get_state_for_groups is given a wildcard filter, just do a complete lookup. Hopefully this will give us the best of both worlds by not filling up the ram if we only need one or two keys, but also making the cache still work for the federation reader usecase.
* | | | Merge pull request #3382 from matrix-org/rav/optimise_state_groupsRichard van der Hoff2018-06-221-5/+1
|\ \ \ \ | | | | | | | | | | Optimise state_group_cache update
| * | | | Optimise state_group_cache updateRichard van der Hoff2018-06-111-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | (1) matrix-org-hotfixes has removed the intern calls; let's do the same here. (2) remove redundant iteritems() so we can used an optimised db update.
* | | | | Merge pull request #3419 from matrix-org/rav/events_per_requestRichard van der Hoff2018-06-223-1/+23
|\ \ \ \ \ | | | | | | | | | | | | Log number of events fetched from DB
| * | | | | Indirect evt_count updates via method callRichard van der Hoff2018-06-222-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | so that we can stub it for the sentinel and not have a billion failing UTs
| * | | | | Log number of events fetched from DBRichard van der Hoff2018-06-213-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we finish processing a request, log the number of events we fetched from the database to handle it. [I'm trying to figure out which requests are responsible for large amounts of event cache churn. It may turn out to be more helpful to add counts to the prometheus per-request/block metrics, but that is an extension to this code anyway.]
* | | | | | Merge pull request #3418 from matrix-org/rav/fix_metric_descAmber Brown2018-06-221-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | Fix description of "python_gc_time" metric
| * | | | | | Fix description of "python_gc_time" metricRichard van der Hoff2018-06-211-1/+1
| | | | | | |
* | | | | | | Pass around the reactor explicitly (#3385)Amber Brown2018-06-2218-72/+111
| | | | | | |
* | | | | | | Populate synapse_federation_client_sent_pdu_destinations:count again (#3386)Amber Brown2018-06-211-3/+7
| | | | | | |
* | | | | | | Fix tcp protocol metrics naming (#3410)Amber Brown2018-06-211-18/+35
| |/ / / / / |/| | | | |
* | | | | | Merge pull request #3416 from matrix-org/rav/restart_indicatorRichard van der Hoff2018-06-202-12/+19
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Write a clear restart indicator in logs
| * | | | | Write a clear restart indicator in logsRichard van der Hoff2018-06-202-12/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'm fed up with never being able to find the point a server restarted in the logs.
* | | | | | Merge pull request #3399 from costacruise/masterRichard van der Hoff2018-06-201-2/+6
|\ \ \ \ \ \ | | | | | | | | | | | | | | Add error code to room creation error
| * | | | | | Add error code to room creation errorMichael Wagner2018-06-141-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This error code is mentioned in the documentation at https://matrix.org/docs/api/client-server/#!/Room32creation/createRoom
* | | | | | | Fix inflight requests metric (incorrect name & traceback) (#3413)Amber Brown2018-06-201-3/+7
| |/ / / / / |/| | | | |
* | | | | | spell gauge correctlyMatthew Hodgson2018-06-161-1/+1
| | | | | |
* | | | | | Merge branch 'master' into developRichard van der Hoff2018-06-143-45/+69
|\ \ \ \ \ \
| * \ \ \ \ \ Merge tag 'v0.31.2'Richard van der Hoff2018-06-143-45/+69
| |\ \ \ \ \ \ | | |/ / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SECURITY UPDATE: Prevent unauthorised users from setting state events in a room when there is no `m.room.power_levels` event in force in the room. (PR #3397) Discussion around the Matrix Spec change proposal for this change can be followed at https://github.com/matrix-org/matrix-doc/issues/1304.
| | * | | | | v0.31.2Richard van der Hoff2018-06-141-1/+2
| | | | | | |
| | * | | | | Merge pull request #3397 from matrix-org/rav/adjust_auth_rulesRichard van der Hoff2018-06-142-44/+67
| | |\ \ \ \ \ | | | | | | | | | | | | | | | | Adjust event auth rules when there is no PL event
| | | * | | | | Make default state_default 50Richard van der Hoff2018-06-141-20/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make it so that, before there is a power-levels event in the room, you need a power level of at least 50 to send state. Partially addresses https://github.com/matrix-org/matrix-doc/issues/1192
| | | * | | | | Clarify interface for event_authRichard van der Hoff2018-06-141-18/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | stop pretending that it returns a boolean, which just almost gave me a heart attack.
| | | * | | | | Refactor get_send_level to take a power_levels eventRichard van der Hoff2018-06-142-8/+39
| | | |/ / / / | | | | | | | | | | | | | | | | | | | | | it makes it easier for me to reason about
* | | | | | | add a last seen metric (#3396)Amber Brown2018-06-141-0/+21
| | | | | | |
* | | | | | | Remove run_on_reactor (#3395)Amber Brown2018-06-1411-59/+6
| | | | | | |
* | | | | | | Merge pull request #3389 from turt2live/travis/name_metricsAmber Brown2018-06-1311-11/+11
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Use the correct flag (enable_metrics) when warning about an incorrect metrics setup
| * | | | | | | The flag is named enable_metrics, not collect_metricsTravis Ralston2018-06-1211-11/+11
| | |_|_|/ / / | |/| | | | | | | | | | | | Signed-off-by: Travis Ralston <travpc@gmail.com>
* / | | | | | Use the RegistryProxy for appservices tooTravis Ralston2018-06-121-1/+2
|/ / / / / / | | | | | | | | | | | | Signed-off-by: Travis Ralston <travpc@gmail.com>
* | | | | | Merge pull request #3276 from matrix-org/dbkr/unbindDavid Baker2018-06-116-16/+115
|\ \ \ \ \ \ | | | | | | | | | | | | | | Remove email addresses / phone numbers from ID servers when they're removed from synapse
| * | | | | | pep8David Baker2018-06-061-3/+3
| | | | | | |
| * | | | | | More doc fixesDavid Baker2018-06-061-2/+2
| | | | | | |
| * | | | | | fix pep8David Baker2018-06-051-3/+5
| | | | | | |
| * | | | | | doc fixesDavid Baker2018-06-052-7/+7
| | | | | | |
| * | | | | | DocstringDavid Baker2018-06-041-0/+14
| | | | | | |
| * | | | | | Fix commentDavid Baker2018-06-041-1/+1
| | | | | | |
| * | | | | | Missing yieldDavid Baker2018-06-041-1/+1
| | | | | | |
| * | | | | | docstringDavid Baker2018-06-041-1/+9
| | | | | | |
| * | | | | | Merge remote-tracking branch 'origin/develop' into dbkr/unbindDavid Baker2018-05-2419-51/+155
| |\ \ \ \ \ \
| * | | | | | | pep8David Baker2018-05-244-8/+13
| | | | | | | |
| * | | | | | | commentDavid Baker2018-05-241-0/+4
| | | | | | | |
| * | | | | | | Unbind 3pids when they're deleted tooDavid Baker2018-05-242-3/+18
| | | | | | | |
| * | | | | | | Hit the 3pid unbind endpoint on deactivationDavid Baker2018-05-234-12/+63
| | | | | | | |
* | | | | | | | fix idiotic typo in state resMatthew Hodgson2018-06-111-2/+2
| | | | | | | |
* | | | | | | | Merge branch 'master' into developNeil Johnson2018-06-081-1/+1
|\ \ \ \ \ \ \ \ | | |_|/ / / / / | |/| | | | | |
| * | | | | | | Merge tag 'v0.31.1'Neil Johnson2018-06-082-1/+5
| |\ \ \ \ \ \ \ | | | |_|/ / / / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes in synapse v0.31.1 (2018-06-08) ======================================= v0.31.1 fixes a security bug in the ``get_missing_events`` federation API where event visibility rules were not applied correctly. We are not aware of it being actively exploited but please upgrade asap. Bug Fixes: * Fix event filtering in get_missing_events handler (PR #3371)
| | * | | | | | changelog a bump versionNeil Johnson2018-06-081-1/+1
| | | |_|/ / / | | |/| | | |
| | * | | | | Fix event filtering in get_missing_events handlerRichard van der Hoff2018-06-081-0/+4
| | | | | | |
* | | | | | | Merge pull request #3372 from matrix-org/rav/better_verification_loggingDavid Baker2018-06-081-6/+25
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Try to log more helpful info when a sig verification fails
| * | | | | | | Try to log more helpful info when a sig verification failsRichard van der Hoff2018-06-081-6/+25
| | |_|_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Firstly, don't swallow the reason for the failure Secondly, don't assume all exceptions are verification failures Thirdly, log a bit of info about the key being used if debug is enabled
* / | | | | | Fix event filtering in get_missing_events handlerRichard van der Hoff2018-06-081-0/+4
|/ / / / / /
* | | | | | Merge pull request #3344 from Half-Shot/hs/as-metricsWill Hunt2018-06-071-0/+22
|\ \ \ \ \ \ | | | | | | | | | | | | | | Add metrics to track appservice transactions
| * | | | | | Let's try labels instead of label, that might workWill Hunt2018-06-051-3/+3
| | | | | | |
| * | | | | | Add metrics to track appservice transactionsWill Hunt2018-06-051-0/+22
| | | | | | |
* | | | | | | Merge pull request #3363 from matrix-org/rav/fix_purgeRichard van der Hoff2018-06-071-7/+5
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Fix event-purge-by-ts admin API
| * | | | | | | fix logRichard van der Hoff2018-06-071-1/+1
| | | | | | | |
| * | | | | | | Fix event-purge-by-ts admin APIRichard van der Hoff2018-06-071-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This got completely broken in 0.30. Fixes #3300.
* | | | | | | | Merge pull request #3355 from matrix-org/rav/fix_federation_backfillRichard van der Hoff2018-06-071-1/+1
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Fix federation backfill from sqlite servers
| * | | | | | | | Fix sql error in _get_state_groups_from_groupsRichard van der Hoff2018-06-061-1/+1
| |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If this was called with a `(type, None)` entry in types (which is supposed to return all state of type `type`), it would explode with a sql error.
* | | | | | | | Merge pull request #3356 from matrix-org/rav/add_missing_attr_depAmber Brown2018-06-071-0/+1
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Make sure that attr is installed