summary refs log tree commit diff
path: root/synapse (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Docstrings for BaseFederationServletRichard van der Hoff2018-08-031-0/+47
| | | | ... to save me reverse-engineering this stuff again.
* Merge pull request #3639 from matrix-org/rav/refactor_error_handlingRichard van der Hoff2018-08-028-142/+123
|\ | | | | Clean up handling of errors from outbound requests
| * Kill off MatrixCodeMessageExceptionRichard van der Hoff2018-08-015-78/+47
| | | | | | | | | | | | | | | | | | | | | | This code brings the SimpleHttpClient into line with the MatrixFederationHttpClient by having it raise HttpResponseExceptions when a request fails (rather than trying to parse for matrix errors and maybe raising MatrixCodeMessageException). Then, whenever we were checking for MatrixCodeMessageException and turning them into SynapseErrors, we now need to check for HttpResponseExceptions and call to_synapse_error.
| * Refactor code for turning HttpResponseException into SynapseErrorRichard van der Hoff2018-08-013-34/+56
| | | | | | | | | | | | | | | | This commit replaces SynapseError.from_http_response_exception with HttpResponseException.to_synapse_error. The new method actually returns a ProxiedRequestError, which allows us to pass through additional metadata from the API call.
| * Be more careful which errors we send back over the C-S APIRichard van der Hoff2018-08-013-32/+22
| | | | | | | | | | | | | | | | | | | | | | | | We really shouldn't be sending all CodeMessageExceptions back over the C-S API; it will include things like 401s which we shouldn't proxy. That means that we need to explicitly turn a few HttpResponseExceptions into SynapseErrors in the federation layer. The effect of the latter is that the matrix errcode will get passed through correctly to calling clients, which might help with some of the random M_UNKNOWN errors when trying to join rooms.
* | Merge pull request #3638 from ↵Richard van der Hoff2018-08-021-129/+148
|\| | | | | | | | | matrix-org/rav/refactor_federation_client_exception_handling Factor out exception handling in federation_client
| * Factor out exception handling in federation_clientRichard van der Hoff2018-08-011-129/+148
| | | | | | | | | | Factor out the error handling from make_membership_event, send_join, and send_leave, so that it can be shared.
* | Merge branch 'master' into developRichard van der Hoff2018-08-029-19/+65
|\ \
| * \ Merge tag 'v0.33.1'Richard van der Hoff2018-08-028-19/+63
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Synapse 0.33.1 (2018-08-02) =========================== SECURITY FIXES -------------- - Fix a potential issue where servers could request events for rooms they have not joined. (`#3641 <https://github.com/matrix-org/synapse/issues/3641>`_) - Fix a potential issue where users could see events in private rooms before they joined. (`#3642 <https://github.com/matrix-org/synapse/issues/3642>`_)
| | * | Prepare 0.33.1Richard van der Hoff2018-08-021-1/+1
| | | |
| | * | Check room visibility for /event/ requestsRichard van der Hoff2018-08-023-6/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make sure that the user has permission to view the requeseted event for /event/{eventId} and /room/{roomId}/event/{eventId} requests. Also check that the event is in the given room for /room/{roomId}/event/{eventId}, for sanity.
| | * | Avoid extra db lookupsRichard van der Hoff2018-08-023-62/+26
| | | | | | | | | | | | | | | | | | | | Since we're about to look up the events themselves anyway, we can skip the extra db queries here.
| | * | Validation for events/rooms in fed requestsRichard van der Hoff2018-08-023-1/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When we get a federation request which refers to an event id, make sure that said event is in the room the caller claims it is in. (patch supplied by @turt2live)
| * | | Merge pull request #3377 from Valodim/note-affinityRichard van der Hoff2018-07-191-0/+2
| |\ \ \ | | |/ / | |/| | document that the affinity package is required for the cpu_affinity setting
| | * | add note that the affinity package is required for the cpu_affinity settingVincent Breitmoser2018-06-091-0/+2
| | | |
* | | | Merge pull request #3621 from matrix-org/erikj/split_fed_storeErik Johnston2018-08-022-89/+100
|\ \ \ \ | | | | | | | | | | Split out DB writes in federation handler
| * | | | update docsErik Johnston2018-08-012-4/+6
| | | | |
| * | | | _persist_auth_tree no longer returns anythingErik Johnston2018-08-011-1/+1
| | | | |
| * | | | Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2018-07-3026-108/+446
| |\ \ \ \ | | | | | | | | | | | | | | | | | | erikj/split_fed_store
| * | | | | Split out DB writes in federation handlerErik Johnston2018-07-252-85/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will allow us to easily add an internal replication API to proxy these reqeusts to master, so that we can move federation APIs to workers.
* | | | | | Merge pull request #3630 from matrix-org/neilj/mau_sign_in_log_in_limitsNeil Johnson2018-08-017-4/+90
|\ \ \ \ \ \ | | | | | | | | | | | | | | Initial impl of capping MAU
| * | | | | | count_monthly_users is now asyncNeil Johnson2018-08-011-1/+2
| | | | | | |
| * | | | | | improve clarityNeil Johnson2018-08-011-4/+5
| | | | | | |
| * | | | | | Merge branch 'develop' of github.com:matrix-org/synapse into ↵Neil Johnson2018-08-0114-187/+98
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | neilj/mau_sign_in_log_in_limits
| * | | | | | | count_monthly_users() asyncNeil Johnson2018-08-011-4/+7
| | | | | | | |
| * | | | | | | remove need to plot limit_usage_by_mauNeil Johnson2018-08-012-7/+6
| | | | | | | |
| * | | | | | | remove errant printNeil Johnson2018-08-011-1/+0
| | | | | | | |
| * | | | | | | make count_monthly_users async synapse/handlers/auth.pyNeil Johnson2018-08-012-17/+18
| | | | | | | |
| * | | | | | | only need to loop if mau limiting is enabledNeil Johnson2018-08-011-1/+2
| | | | | | | |
| * | | | | | | coding styleNeil Johnson2018-07-315-6/+10
| | | | | | | |
| * | | | | | | remove errant loggingNeil Johnson2018-07-301-1/+0
| | | | | | | |
| * | | | | | | actually close connNeil Johnson2018-07-301-4/+8
| | | | | | | |
| * | | | | | | factor out metrics from __init__ to app/homeserverNeil Johnson2018-07-302-25/+32
| | | | | | | |
| * | | | | | | limit register and sign in on number of monthly usersNeil Johnson2018-07-305-2/+69
| | |_|/ / / / | |/| | | | |
* | | | | | | Merge pull request #3620 from fuzzmz/return-404-room-not-foundRichard van der Hoff2018-08-011-2/+2
|\ \ \ \ \ \ \ | |_|_|_|_|_|/ |/| | | | | | return 404 if room not found
| * | | | | | return NotFoundError if room not foundSerban Constantin2018-07-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Per the Client-Server API[0] we should return `M_NOT_FOUND` if the room isn't found instead of generic SynapseError. This ensures that /directory/list API returns 404 for room not found instead of 400. [0]: https://matrix.org/docs/spec/client_server/unstable.html#get-matrix-client-r0-directory-list-room-roomid Signed-off-by: Serban Constantin <serban.constantin@gmail.com>
* | | | | | | Python 3: Convert some unicode/bytes uses (#3569)Amber Brown2018-08-0214-48/+96
| |_|/ / / / |/| | | | |
* | | | | | Merge pull request #3634 from matrix-org/rav/wtf_is_a_replication_layerRichard van der Hoff2018-08-011-14/+14
|\ \ \ \ \ \ | | | | | | | | | | | | | | rename replication_layer to federation_client
| * | | | | | rename replication_layer to federation_clientRichard van der Hoff2018-07-311-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I have HAD ENOUGH of trying to remember wtf a replication layer is in terms of classes.
* | | | | | | Merge pull request #3384 from matrix-org/rav/rewrite_cachedlist_decoratorRichard van der Hoff2018-08-011-67/+64
|\ \ \ \ \ \ \ | |_|/ / / / / |/| | | | | | Rewrite cache list decorator
| * | | | | | fix invalidationRichard van der Hoff2018-07-271-1/+1
| | | | | | |
| * | | | | | Rewrite cache list decoratorRichard van der Hoff2018-07-271-67/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because it was complicated and annoyed me. I suspect this will be more efficient too.
* | | | | | | Merge pull request #3628 from turt2live/travis/goodby-pdu-failuresTravis Ralston2018-07-315-96/+7
|\ \ \ \ \ \ \ | |_|/ / / / / |/| | | | | | Remove pdu_failures from transactions
| * | | | | | Remove pdu_failures from transactionsTravis Ralston2018-07-305-96/+7
| | |/ / / / | |/| | | | | | | | | | The field is never read from, and all the opportunities given to populate it are not utilized. It should be very safe to remove this.
* | | | | | Merge pull request #3612 from matrix-org/rav/store_heirarchyRichard van der Hoff2018-07-316-6/+10
|\ \ \ \ \ \ | | | | | | | | | | | | | | Make EventStore inherit from EventFederationStore
| * | | | | | reinstate explicit include of EventsWorkerStoreRichard van der Hoff2018-07-311-1/+3
| | | | | | |
| * | | | | | Make EventStore inherit from EventFederationStoreRichard van der Hoff2018-07-266-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (since it uses methods therein) Turns out that we had a bunch of things which were incorrectly importing EventWorkerStore from events.py rather than events_worker.py, which broke once I removed the import into events.py.
* | | | | | | Only import secrets when availableKrombel2018-07-301-4/+3
| |/ / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | secrets got introduced in python 3.6 so this class is not available in 3.5 and before. This now checks for the current running version and only tries using secrets if the version is 3.6 or above Signed-Off-By: Matthias Kesler <krombel@krombel.de>
* | | | | | make /context lazyload & filter aware (#3567)Matthew Hodgson2018-07-274-7/+42
| |/ / / / |/| | | | | | | | | make /context lazyload & filter aware.
* | | | | Merge pull request #3391 from t3chguy/t3chguy/default_inviter_display_name_3pidRichard van der Hoff2018-07-271-0/+4
|\ \ \ \ \ | | | | | | | | | | | | if inviter_display_name == ""||None then default to inviter MXID
| * \ \ \ \ Merge branch 'develop' of github.com:matrix-org/synapse into ↵Michael Telatynski2018-07-24332-10409/+26535
| |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | t3chguy/default_inviter_display_name_3pid
| * | | | | | if inviter_display_name == ""||None then default to inviter MXIDMichael Telatynski2018-06-131-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | to prevent email invite from "None"
* | | | | | | Merge pull request #3616 from matrix-org/travis/event_id_send_leaveRichard van der Hoff2018-07-261-2/+2
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Update the send_leave path to be an event_id
| * | | | | | | Update the send_leave path to be an event_idTravis Ralston2018-07-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | It's still not used, however the parameter is an event ID not a transaction ID.
* | | | | | | | Merge pull request #3614 from matrix-org/rav/stop_populating_event_contentRichard van der Hoff2018-07-263-2/+98
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Stop populating events.content
| * | | | | | | | Create the column nullableRichard van der Hoff2018-07-262-9/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's no real point in ever making the column non-nullable, and doing so breaks the sytests.
| * | | | | | | | Stop populating events.contentRichard van der Hoff2018-07-262-1/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This field is no longer read from, so we should stop populating it. Once we're happy that this doesn't break everything, and a rollback is unlikely, we can think about dropping the column.
* | | | | | | | | Deduplicate redundant lazy-loaded members (#3331)Matthew Hodgson2018-07-262-25/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * attempt at deduplicating lazy-loaded members as per the proposal; we can deduplicate redundant lazy-loaded members which are sent in the same sync sequence. we do this heuristically rather than requiring the client to somehow tell us which members it has chosen to cache, by instead caching the last N members sent to a client, and not sending them again. For now we hardcode N to 100. Each cache for a given (user,device) tuple is in turn cached for up to X minutes (to avoid the caches building up). For now we hardcode X to 30. * add include_redundant_members filter option & make it work * remove stale todo * add tests for _get_some_state_from_cache * incorporate review
* | | | | | | | | Merge pull request #3613 from matrix-org/rav/stop_using_event_edges_room_idRichard van der Hoff2018-07-262-8/+6
|\ \ \ \ \ \ \ \ \ | |_|/ / / / / / / |/| | | | | | | | Remove some redundant joins on event_edges.room_id
| * | | | | | | | Remove some redundant joins on event_edges.room_idRichard van der Hoff2018-07-262-8/+6
| |/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We've long passed the point where it's possible to have the same event_id in different tables, so these join conditions are redundant: we can just join on event_id. event_edges is of non-trivial size, and the room_id column is wasteful, so let's stop reading from it. In future, we can stop writing to it, and then drop it.
* | | | | | | | Merge pull request #3610 from matrix-org/rav/fix_looping_callsRichard van der Hoff2018-07-2612-15/+23
|\ \ \ \ \ \ \ \ | |/ / / / / / / |/| | | | | | | Fix some looping_call calls which were broken in #3604
| * | | | | | | Fix some looping_call calls which were broken in #3604Richard van der Hoff2018-07-2612-15/+23
| | |_|/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It turns out that looping_call does check the deferred returned by its callback, and (at least in the case of client_ips), we were relying on this, and I broke it in #3604. Update run_as_background_process to return the deferred, and make sure we return it to clock.looping_call.
* / | | | | | comment on event_edgesRichard van der Hoff2018-07-261-1/+2
|/ / / / / /
* | | | | | Merge pull request #2970 from matrix-org/matthew/filter_membersMatthew Hodgson2018-07-263-62/+212
|\ \ \ \ \ \ | | | | | | | | | | | | | | Implement the lazy_load_members room state filter parameter
| * | | | | | switch missing_types to be a boolMatthew Hodgson2018-07-251-4/+4
| | | | | | |
| * | | | | | Merge branch 'develop' into matthew/filter_membersMatthew Hodgson2018-07-2523-231/+349
| |\ \ \ \ \ \ | | | |_|/ / / | | |/| | | |
| * | | | | | incorporate more review.Matthew Hodgson2018-07-251-16/+14
| | | | | | |
| * | | | | | handle the edge case for _get_some_state_from_cache where types is []Matthew Hodgson2018-07-241-1/+7
| | | | | | |
| * | | | | | Merge branch 'develop' into matthew/filter_membersMatthew Hodgson2018-07-241-12/+4
| |\ \ \ \ \ \
| * | | | | | | clarify comment on p_idsMatthew Hodgson2018-07-241-1/+2
| | | | | | | |
| * | | | | | | consider non-filter_type types as wildcards, thus missing from the ↵Matthew Hodgson2018-07-241-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | state-group-cache
| * | | | | | | rather than adding ll_ids, remove them from p_idsMatthew Hodgson2018-07-241-5/+6
| | | | | | | |
| * | | | | | | Merge branch 'develop' into matthew/filter_membersMatthew Hodgson2018-07-2413-316/+409
| |\ \ \ \ \ \ \
| * | | | | | | | incorporate more reviewMatthew Hodgson2018-07-242-30/+18
| | | | | | | | |
| * | | | | | | | handle case where types is [] on postgres correctlyMatthew Hodgson2018-07-231-1/+1
| | | | | | | | |
| * | | | | | | | Merge branch 'develop' into matthew/filter_membersMatthew Hodgson2018-07-2325-274/+646
| |\ \ \ \ \ \ \ \
| * | | | | | | | | incorporate reviewMatthew Hodgson2018-07-232-52/+35
| | | | | | | | | |
| * | | | | | | | | fix thinkos; unbreak testsMatthew Hodgson2018-07-191-2/+2
| | | | | | | | | |
| * | | | | | | | | incorporate reviewMatthew Hodgson2018-07-192-20/+31
| | | | | | | | | |
| * | | | | | | | | add a filtered_types param to limit filtering to specific typesMatthew Hodgson2018-07-192-82/+96
| | | | | | | | | |
| * | | | | | | | | merge develop pydoc for _get_state_for_groupsMatthew Hodgson2018-07-19271-2455/+3532
| |\ \ \ \ \ \ \ \ \
| * \ \ \ \ \ \ \ \ \ Merge branch 'develop' into matthew/filter_membersMatthew Hodgson2018-06-1020-124/+176
| |\ \ \ \ \ \ \ \ \ \
| * \ \ \ \ \ \ \ \ \ \ Merge branch 'develop' into matthew/filter_membersMatthew Hodgson2018-06-0454-166/+398
| |\ \ \ \ \ \ \ \ \ \ \
| * | | | | | | | | | | | more commentsMatthew Hodgson2018-06-041-0/+7
| | | | | | | | | | | | |
| * | | | | | | | | | | | add lazy_load_members to the filter json schemaMatthew Hodgson2018-05-291-1/+4
| | | | | | | | | | | | |
| * | | | | | | | | | | | pep8Matthew Hodgson2018-05-291-0/+1
| | | | | | | | | | | | |
| * | | | | | | | | | | | disable CPUMetrics if no /proc/self/statMatthew Hodgson2018-05-291-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fixes build on macOS again
| * | | | | | | | | | | | add pydocMatthew Hodgson2018-05-292-27/+67
| | | | | | | | | | | | |
| * | | | | | | | | | | | merge developMatthew Hodgson2018-05-29186-2989/+5608
| |\ \ \ \ \ \ \ \ \ \ \ \
| * | | | | | | | | | | | | make lazy_load_members configurable in filtersMatthew Hodgson2018-03-192-9/+15
| | | | | | | | | | | | | |
| * | | | | | | | | | | | | reshuffle todo & commentsMatthew Hodgson2018-03-191-2/+10
| | | | | | | | | | | | | |
| * | | | | | | | | | | | | only get member state IDs for incremental syncs if we're filteringMatthew Hodgson2018-03-181-5/+5
| | | | | | | | | | | | | |
| * | | | | | | | | | | | | remove stale importMatthew Hodgson2018-03-161-1/+0
| | | | | | | | | | | | | |
| * | | | | | | | | | | | | remove debugMatthew Hodgson2018-03-161-4/+0
| | | | | | | | | | | | | |
| * | | | | | | | | | | | | fix tsm search againMatthew Hodgson2018-03-161-5/+4
| | | | | | | | | | | | | |
| * | | | | | | | | | | | | add state_ids for timeline entriesMatthew Hodgson2018-03-161-4/+14
| | | | | | | | | | | | | |
| * | | | | | | | | | | | | simplify timeline_start_membersMatthew Hodgson2018-03-161-14/+13
| | | | | | | | | | | | | |
| * | | | | | | | | | | | | Replace some ujson with simplejson to make it workErik Johnston2018-03-164-4/+5
| | | | | | | | | | | | | |
| * | | | | | | | | | | | | make incr syncs workMatthew Hodgson2018-03-161-3/+4
| | | | | | | | | | | | | |
| * | | | | | | | | | | | | Merge branch 'develop' into matthew/filter_membersMatthew Hodgson2018-03-1410-144/+711
| |\ \ \ \ \ \ \ \ \ \ \ \ \
| * | | | | | | | | | | | | | pep8Matthew Hodgson2018-03-141-2/+2
| | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | add copyright to nudge CIMatthew Hodgson2018-03-141-1/+2
| | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | oopsMatthew Hodgson2018-03-131-1/+1
| | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | make it workMatthew Hodgson2018-03-132-7/+9
| | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | remove comment now #2969 is fixedMatthew Hodgson2018-03-131-6/+0
| | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | merge proper fix to bug 2969Matthew Hodgson2018-03-1334-301/+515
| |\ \ \ \ \ \ \ \ \ \ \ \ \ \
| | * | | | | | | | | | | | | | typoeMatthew Hodgson2018-03-131-1/+1
| | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | disable optimisation for searching for state groupsMatthew Hodgson2018-03-131-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when type filter includes wildcards on state_key
| | * | | | | | | | | | | | | | build where_clause sanelyMatthew Hodgson2018-03-131-6/+4
| | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | PR feedbackzMatthew Hodgson2018-03-131-3/+2
| | | | | | | | | | | | | | | |
| | * | | | | | | | | | | | | | fix bug #2926Matthew Hodgson2018-03-131-4/+17
| | | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | | ensure we always include the members for a given timeline blockMatthew Hodgson2018-03-131-4/+32
| | | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | | correctly handle None state_keysMatthew Hodgson2018-03-121-10/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and fix include_other_types thinko
| * | | | | | | | | | | | | | | fix sqlite where clauseMatthew Hodgson2018-03-121-2/+3
| | | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | | typosMatthew Hodgson2018-03-112-2/+4
| | | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | | WIP experiment in lazyloading room membersMatthew Hodgson2018-03-112-17/+73
| | | | | | | | | | | | | | | |
* | | | | | | | | | | | | | | | Fix a minor documentation typo in on_make_leaveTravis Ralston2018-07-251-1/+1
| |_|_|_|_|_|_|_|_|_|/ / / / / |/| | | | | | | | | | | | | |
* | | | | | | | | | | | | | | Merge pull request #3603 from matrix-org/erikj/handle_outliersErik Johnston2018-07-251-6/+8
|\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Correctly handle outliers during persist events
| * | | | | | | | | | | | | | | Actually fix it by adding continueErik Johnston2018-07-251-0/+1
| | | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | | Fix typo in conditionalErik Johnston2018-07-251-1/+1
| | | | | | | | | | | | | | | |
| * | | | | | | | | | | | | | | Correctly handle outliers during persist eventsErik Johnston2018-07-251-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We incorrectly asserted that all contexts must have a non None state group without consider outliers. This would usually be fine as the assertion would never be hit, as there is a shortcut during persistence if the forward extremities don't change. However, if the outlier is being persisted with non-outlier events, the function would be called and the assertion would be hit. Fixes #3601
* | | | | | | | | | | | | | | | Merge pull request #3606 from matrix-org/rav/logcontext_fixes_once_moreRichard van der Hoff2018-07-252-5/+10
|\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix another logcontext leak in _persist_events
| * | | | | | | | | | | | | | | | Fix another logcontext leak in _persist_eventsRichard van der Hoff2018-07-252-5/+10
| |/ / / / / / / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to run the errback in the sentinel context to avoid losing our own context. Also: add logging to runInteraction to help identify where "Starting db connection from sentinel context" warnings are coming from
* | | | | | | | | | | | | | | | 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 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).