Skip to content

Commit

Permalink
Merge tag 'v0.27.2' into websocket
Browse files Browse the repository at this point in the history
Changes in synapse v0.27.2 (2018-03-26)
=======================================

Bug fixes:

* Fix bug which broke TCP replication between workers (PR matrix-org#3015)
  • Loading branch information
krombel committed Mar 26, 2018
2 parents cfb001b + 691f849 commit c94b619
Show file tree
Hide file tree
Showing 81 changed files with 1,512 additions and 515 deletions.
86 changes: 82 additions & 4 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,89 @@
Unreleased
==========
Changes in synapse v0.27.2 (2018-03-26)
=======================================

Bug fixes:

* Fix bug which broke TCP replication between workers (PR #3015)


Changes in synapse v0.27.1 (2018-03-26)
=======================================

Meta release as v0.27.0 temporarily pointed to the wrong commit


Changes in synapse v0.27.0 (2018-03-26)
=======================================

No changes since v0.27.0-rc2


Changes in synapse v0.27.0-rc2 (2018-03-19)
===========================================

Pulls in v0.26.1

Bug fixes:

* Fix bug introduced in v0.27.0-rc1 that causes much increased memory usage in state cache (PR #3005)

synctl no longer starts the main synapse when using ``-a`` option with workers.
A new worker file should be added with ``worker_app: synapse.app.homeserver``.

Changes in synapse v0.26.1 (2018-03-15)
=======================================

Bug fixes:

* Fix bug where an invalid event caused server to stop functioning correctly,
due to parsing and serializing bugs in ujson library (PR #3008)


Changes in synapse v0.27.0-rc1 (2018-03-14)
===========================================

The common case for running Synapse is not to run separate workers, but for those that do, be aware that synctl no longer starts the main synapse when using ``-a`` option with workers. A new worker file should be added with ``worker_app: synapse.app.homeserver``.

This release also begins the process of renaming a number of the metrics
reported to prometheus. See `docs/metrics-howto.rst <docs/metrics-howto.rst#block-and-response-metrics-renamed-for-0-27-0>`_.
Note that the v0.28.0 release will remove the deprecated metric names.

Features:

* Add ability for ASes to override message send time (PR #2754)
* Add support for custom storage providers for media repository (PR #2867, #2777, #2783, #2789, #2791, #2804, #2812, #2814, #2857, #2868, #2767)
* Add purge API features, see `docs/admin_api/purge_history_api.rst <docs/admin_api/purge_history_api.rst>`_ for full details (PR #2858, #2867, #2882, #2946, #2962, #2943)
* Add support for whitelisting 3PIDs that users can register. (PR #2813)
* Add ``/room/{id}/event/{id}`` API (PR #2766)
* Add an admin API to get all the media in a room (PR #2818) Thanks to @turt2live!
* Add ``federation_domain_whitelist`` option (PR #2820, #2821)


Changes:

* Continue to factor out processing from main process and into worker processes. See updated `docs/workers.rst <docs/metrics-howto.rst>`_ (PR #2892 - #2904, #2913, #2920 - #2926, #2947, #2847, #2854, #2872, #2873, #2874, #2928, #2929, #2934, #2856, #2976 - #2984, #2987 - #2989, #2991 - #2993, #2995, #2784)
* Ensure state cache is used when persisting events (PR #2864, #2871, #2802, #2835, #2836, #2841, #2842, #2849)
* Change the default config to bind on both IPv4 and IPv6 on all platforms (PR #2435) Thanks to @silkeh!
* No longer require a specific version of saml2 (PR #2695) Thanks to @okurz!
* Remove ``verbosity``/``log_file`` from generated config (PR #2755)
* Add and improve metrics and logging (PR #2770, #2778, #2785, #2786, #2787, #2793, #2794, #2795, #2809, #2810, #2833, #2834, #2844, #2965, #2927, #2975, #2790, #2796, #2838)
* When using synctl with workers, don't start the main synapse automatically (PR #2774)
* Minor performance improvements (PR #2773, #2792)
* Use a connection pool for non-federation outbound connections (PR #2817)
* Make it possible to run unit tests against postgres (PR #2829)
* Update pynacl dependency to 1.2.1 or higher (PR #2888) Thanks to @bachp!
* Remove ability for AS users to call /events and /sync (PR #2948)
* Use bcrypt.checkpw (PR #2949) Thanks to @krombel!

Bug fixes:

* Fix broken ``ldap_config`` config option (PR #2683) Thanks to @seckrv!
* Fix error message when user is not allowed to unban (PR #2761) Thanks to @turt2live!
* Fix publicised groups GET API (singular) over federation (PR #2772)
* Fix user directory when using ``user_directory_search_all_users`` config option (PR #2803, #2831)
* Fix error on ``/publicRooms`` when no rooms exist (PR #2827)
* Fix bug in quarantine_media (PR #2837)
* Fix url_previews when no Content-Type is returned from URL (PR #2845)
* Fix rare race in sync API when joining room (PR #2944)
* Fix slow event search, switch back from GIST to GIN indexes (PR #2769, #2848)


Changes in synapse v0.26.0 (2018-01-05)
Expand Down
10 changes: 7 additions & 3 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ use github's pull request workflow to review the contribution, and either ask
you to make any refinements needed or merge it and make them ourselves. The
changes will then land on master when we next do a release.

We use Jenkins for continuous integration (http://matrix.org/jenkins), and
typically all pull requests get automatically tested Jenkins: if your change breaks the build, Jenkins will yell about it in #matrix-dev:matrix.org so please lurk there and keep an eye open.
We use `Jenkins <http://matrix.org/jenkins>`_ and
`Travis <https://travis-ci.org/matrix-org/synapse>`_ for continuous
integration. All pull requests to synapse get automatically tested by Travis;
the Jenkins builds require an adminstrator to start them. If your change
breaks the build, this will be shown in github, so please keep an eye on the
pull request for feedback.

Code style
~~~~~~~~~~
Expand Down Expand Up @@ -115,4 +119,4 @@ can't be accepted. Git makes this trivial - just use the -s flag when you do
Conclusion
~~~~~~~~~~

That's it! Matrix is a very open and collaborative project as you might expect given our obsession with open communication. If we're going to successfully matrix together all the fragmented communication technologies out there we are reliant on contributions and collaboration from the community to do so. So please get involved - and we hope you have as much fun hacking on Matrix as we do!
That's it! Matrix is a very open and collaborative project as you might expect given our obsession with open communication. If we're going to successfully matrix together all the fragmented communication technologies out there we are reliant on contributions and collaboration from the community to do so. So please get involved - and we hope you have as much fun hacking on Matrix as we do!
15 changes: 15 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,10 @@ https://matrix.org/docs/projects/try-matrix-now.html (or build your own with one
Fedora
------

Synapse is in the Fedora repositories as ``matrix-synapse``::

sudo dnf install matrix-synapse

Oleg Girko provides Fedora RPMs at
https://obs.infoserver.lv/project/monitor/matrix-synapse

Expand Down Expand Up @@ -899,6 +903,17 @@ This should end with a 'PASSED' result::

PASSED (successes=143)

Running the Integration Tests
=============================

Synapse is accompanied by `SyTest <https://github.com/matrix-org/sytest>`_,
a Matrix homeserver integration testing suite, which uses HTTP requests to
access the API as a Matrix client would. It is able to run Synapse directly from
the source tree, so installation of the server is not required.

Testing with SyTest is recommended for verifying that changes related to the
Client-Server API are functioning correctly. See the `installation instructions
<https://github.com/matrix-org/sytest#installing>`_ for details.

Building Internal API Documentation
===================================
Expand Down
33 changes: 31 additions & 2 deletions docs/admin_api/purge_history_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ including an ``access_token`` of a server admin.

By default, events sent by local users are not deleted, as they may represent
the only copies of this content in existence. (Events sent by remote users are
deleted, and room state data before the cutoff is always removed).
deleted.)

To delete local events as well, set ``delete_local_events`` in the body:
Room state data (such as joins, leaves, topic) is always preserved.

To delete local message events as well, set ``delete_local_events`` in the body:

.. code:: json
Expand All @@ -32,3 +34,30 @@ specified by including an event_id in the URI, or by setting a
id is given, that event (and others at the same graph depth) will be retained.
If ``purge_up_to_ts`` is given, it should be a timestamp since the unix epoch,
in milliseconds.

The API starts the purge running, and returns immediately with a JSON body with
a purge id:

.. code:: json
{
"purge_id": "<opaque id>"
}
Purge status query
------------------

It is possible to poll for updates on recent purges with a second API;

``GET /_matrix/client/r0/admin/purge_history_status/<purge_id>``

(again, with a suitable ``access_token``). This API returns a JSON body like
the following:

.. code:: json
{
"status": "active"
}
The status will be one of ``active``, ``complete``, or ``failed``.
8 changes: 4 additions & 4 deletions docs/log_contexts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ Obviously that option means that the operations done in
that might be fixed by setting a different logcontext via a ``with
LoggingContext(...)`` in ``background_operation``).

The second option is to use ``logcontext.preserve_fn``, which wraps a function
so that it doesn't reset the logcontext even when it returns an incomplete
deferred, and adds a callback to the returned deferred to reset the
The second option is to use ``logcontext.run_in_background``, which wraps a
function so that it doesn't reset the logcontext even when it returns an
incomplete deferred, and adds a callback to the returned deferred to reset the
logcontext. In other words, it turns a function that follows the Synapse rules
about logcontexts and Deferreds into one which behaves more like an external
function — the opposite operation to that described in the previous section.
Expand All @@ -293,7 +293,7 @@ It can be used like this:
def do_request_handling():
yield foreground_operation()
logcontext.preserve_fn(background_operation)()
logcontext.run_in_background(background_operation)
# this will now be logged against the request context
logger.debug("Request handling complete")
Expand Down
2 changes: 1 addition & 1 deletion docs/workers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ file. For example::
``synapse.app.event_creator``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Handles non-state event creation. It can handle REST endpoints matching:
Handles non-state event creation. It can handle REST endpoints matching::

^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/send

Expand Down
2 changes: 1 addition & 1 deletion synapse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
""" This is a reference implementation of a Matrix home server.
"""

__version__ = "0.26.0"
__version__ = "0.27.2"
2 changes: 1 addition & 1 deletion synapse/api/filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from synapse.types import UserID, RoomID
from twisted.internet import defer

import ujson as json
import simplejson as json
import jsonschema
from jsonschema import FormatChecker

Expand Down
1 change: 0 additions & 1 deletion synapse/app/client_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ def start(config_options):
)

ss.setup()
ss.get_handlers()
ss.start_listening(config.worker_listeners)

def start():
Expand Down
15 changes: 13 additions & 2 deletions synapse/app/event_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,20 @@
from synapse.replication.slave.storage.appservice import SlavedApplicationServiceStore
from synapse.replication.slave.storage.client_ips import SlavedClientIpStore
from synapse.replication.slave.storage.devices import SlavedDeviceStore
from synapse.replication.slave.storage.directory import DirectoryStore
from synapse.replication.slave.storage.events import SlavedEventStore
from synapse.replication.slave.storage.profile import SlavedProfileStore
from synapse.replication.slave.storage.push_rule import SlavedPushRuleStore
from synapse.replication.slave.storage.pushers import SlavedPusherStore
from synapse.replication.slave.storage.receipts import SlavedReceiptsStore
from synapse.replication.slave.storage.registration import SlavedRegistrationStore
from synapse.replication.slave.storage.room import RoomStore
from synapse.replication.slave.storage.transactions import TransactionStore
from synapse.replication.tcp.client import ReplicationClientHandler
from synapse.rest.client.v1.room import RoomSendEventRestServlet
from synapse.rest.client.v1.room import (
RoomSendEventRestServlet, RoomMembershipRestServlet, RoomStateEventRestServlet,
JoinRoomAliasServlet,
)
from synapse.server import HomeServer
from synapse.storage.engines import create_engine
from synapse.util.httpresourcetree import create_resource_tree
Expand All @@ -52,6 +58,9 @@


class EventCreatorSlavedStore(
DirectoryStore,
TransactionStore,
SlavedProfileStore,
SlavedAccountDataStore,
SlavedPusherStore,
SlavedReceiptsStore,
Expand Down Expand Up @@ -85,6 +94,9 @@ def _listen_http(self, listener_config):
elif name == "client":
resource = JsonResource(self, canonical_json=False)
RoomSendEventRestServlet(self).register(resource)
RoomMembershipRestServlet(self).register(resource)
RoomStateEventRestServlet(self).register(resource)
JoinRoomAliasServlet(self).register(resource)
resources.update({
"/_matrix/client/r0": resource,
"/_matrix/client/unstable": resource,
Expand Down Expand Up @@ -161,7 +173,6 @@ def start(config_options):
)

ss.setup()
ss.get_handlers()
ss.start_listening(config.worker_listeners)

def start():
Expand Down
1 change: 0 additions & 1 deletion synapse/app/federation_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ def start(config_options):
)

ss.setup()
ss.get_handlers()
ss.start_listening(config.worker_listeners)

def start():
Expand Down
1 change: 0 additions & 1 deletion synapse/app/frontend_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ def start(config_options):
)

ss.setup()
ss.get_handlers()
ss.start_listening(config.worker_listeners)

def start():
Expand Down
2 changes: 1 addition & 1 deletion synapse/app/homeserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def start():
hs.get_state_handler().start_caching()
hs.get_datastore().start_profiling()
hs.get_datastore().start_doing_background_updates()
hs.get_replication_layer().start_get_pdu_cache()
hs.get_federation_client().start_get_pdu_cache()

register_memory_metrics(hs)

Expand Down
1 change: 0 additions & 1 deletion synapse/app/media_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ def start(config_options):
)

ss.setup()
ss.get_handlers()
ss.start_listening(config.worker_listeners)

def start():
Expand Down
4 changes: 3 additions & 1 deletion synapse/config/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ def default_config(self, **kwargs):
# Set the number of bcrypt rounds used to generate password hash.
# Larger numbers increase the work factor needed to generate the hash.
# The default number of rounds is 12.
# The default number is 12 (which equates to 2^12 rounds).
# N.B. that increasing this will exponentially increase the time required
# to register or login - e.g. 24 => 2^24 rounds which will take >20 mins.
bcrypt_rounds: 12
# Allows users to register as guests without a password/email/etc, and
Expand Down
8 changes: 0 additions & 8 deletions synapse/federation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,3 @@

""" This package includes all the federation specific logic.
"""

from .replication import ReplicationLayer


def initialize_http_replication(hs):
transport = hs.get_federation_transport_client()

return ReplicationLayer(hs, transport)
6 changes: 6 additions & 0 deletions synapse/federation/federation_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@

class FederationBase(object):
def __init__(self, hs):
self.hs = hs

self.server_name = hs.hostname
self.keyring = hs.get_keyring()
self.spam_checker = hs.get_spam_checker()
self.store = hs.get_datastore()
self._clock = hs.get_clock()

@defer.inlineCallbacks
def _check_sigs_and_hash_and_fetch(self, origin, pdus, outlier=False,
Expand Down
1 change: 1 addition & 0 deletions synapse/federation/federation_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def __init__(self, hs):
self._clear_tried_cache, 60 * 1000,
)
self.state = hs.get_state_handler()
self.transport_layer = hs.get_federation_transport_client()

def _clear_tried_cache(self):
"""Clear pdu_destination_tried cache"""
Expand Down
Loading

0 comments on commit c94b619

Please sign in to comment.