mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-18 08:54:54 +03:00
Merge branch 'develop' into bwindels/registerasregularuser
This commit is contained in:
commit
c5e1de677d
136 changed files with 1869 additions and 926 deletions
|
@ -1,5 +1,21 @@
|
||||||
version: 2
|
version: 2
|
||||||
jobs:
|
jobs:
|
||||||
|
dockerhubuploadrelease:
|
||||||
|
machine: true
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: docker build -f docker/Dockerfile -t matrixdotorg/synapse:$CIRCLE_TAG .
|
||||||
|
- run: docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD
|
||||||
|
- run: docker push matrixdotorg/synapse:$CIRCLE_TAG
|
||||||
|
dockerhubuploadlatest:
|
||||||
|
machine: true
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: docker build -f docker/Dockerfile -t matrixdotorg/synapse:$CIRCLE_SHA1 .
|
||||||
|
- run: docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD
|
||||||
|
- run: docker tag matrixdotorg/synapse:$CIRCLE_SHA1 matrixdotorg/synapse:latest
|
||||||
|
- run: docker push matrixdotorg/synapse:$CIRCLE_SHA1
|
||||||
|
- run: docker push matrixdotorg/synapse:latest
|
||||||
sytestpy2:
|
sytestpy2:
|
||||||
machine: true
|
machine: true
|
||||||
steps:
|
steps:
|
||||||
|
@ -99,23 +115,45 @@ workflows:
|
||||||
version: 2
|
version: 2
|
||||||
build:
|
build:
|
||||||
jobs:
|
jobs:
|
||||||
- sytestpy2
|
- sytestpy2:
|
||||||
- sytestpy2postgres
|
filters:
|
||||||
- sytestpy3
|
branches:
|
||||||
- sytestpy3postgres
|
only: /develop|master|release-.*/
|
||||||
|
- sytestpy2postgres:
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
only: /develop|master|release-.*/
|
||||||
|
- sytestpy3:
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
only: /develop|master|release-.*/
|
||||||
|
- sytestpy3postgres:
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
only: /develop|master|release-.*/
|
||||||
- sytestpy2merged:
|
- sytestpy2merged:
|
||||||
filters:
|
filters:
|
||||||
branches:
|
branches:
|
||||||
ignore: /develop|master/
|
ignore: /develop|master|release-.*/
|
||||||
- sytestpy2postgresmerged:
|
- sytestpy2postgresmerged:
|
||||||
filters:
|
filters:
|
||||||
branches:
|
branches:
|
||||||
ignore: /develop|master/
|
ignore: /develop|master|release-.*/
|
||||||
- sytestpy3merged:
|
- sytestpy3merged:
|
||||||
filters:
|
filters:
|
||||||
branches:
|
branches:
|
||||||
ignore: /develop|master/
|
ignore: /develop|master|release-.*/
|
||||||
- sytestpy3postgresmerged:
|
- sytestpy3postgresmerged:
|
||||||
filters:
|
filters:
|
||||||
branches:
|
branches:
|
||||||
ignore: /develop|master/
|
ignore: /develop|master|release-.*/
|
||||||
|
- dockerhubuploadrelease:
|
||||||
|
filters:
|
||||||
|
tags:
|
||||||
|
only: /^v[0-9].[0-9]+.[0-9]+(.[0-9]+)?/
|
||||||
|
branches:
|
||||||
|
ignore: /.*/
|
||||||
|
- dockerhubuploadlatest:
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
only: master
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,6 +1,7 @@
|
||||||
*.pyc
|
*.pyc
|
||||||
.*.swp
|
.*.swp
|
||||||
*~
|
*~
|
||||||
|
*.lock
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
_trial_temp/
|
_trial_temp/
|
||||||
|
|
|
@ -20,6 +20,9 @@ matrix:
|
||||||
- python: 2.7
|
- python: 2.7
|
||||||
env: TOX_ENV=py27
|
env: TOX_ENV=py27
|
||||||
|
|
||||||
|
- python: 2.7
|
||||||
|
env: TOX_ENV=py27-old
|
||||||
|
|
||||||
- python: 2.7
|
- python: 2.7
|
||||||
env: TOX_ENV=py27-postgres TRIAL_FLAGS="-j 4"
|
env: TOX_ENV=py27-postgres TRIAL_FLAGS="-j 4"
|
||||||
services:
|
services:
|
||||||
|
@ -31,6 +34,11 @@ matrix:
|
||||||
- python: 3.6
|
- python: 3.6
|
||||||
env: TOX_ENV=py36
|
env: TOX_ENV=py36
|
||||||
|
|
||||||
|
- python: 3.6
|
||||||
|
env: TOX_ENV=py36-postgres TRIAL_FLAGS="-j 4"
|
||||||
|
services:
|
||||||
|
- postgresql
|
||||||
|
|
||||||
- python: 3.6
|
- python: 3.6
|
||||||
env: TOX_ENV=check_isort
|
env: TOX_ENV=check_isort
|
||||||
|
|
||||||
|
|
74
CHANGES.md
74
CHANGES.md
|
@ -1,3 +1,77 @@
|
||||||
|
Synapse 0.33.5.1 (2018-09-25)
|
||||||
|
=============================
|
||||||
|
|
||||||
|
Internal Changes
|
||||||
|
----------------
|
||||||
|
|
||||||
|
- Fix incompatibility with older Twisted version in tests. Thanks
|
||||||
|
@OlegGirko! ([\#3940](https://github.com/matrix-org/synapse/issues/3940))
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 0.33.5 (2018-09-24)
|
||||||
|
===========================
|
||||||
|
|
||||||
|
No significant changes.
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 0.33.5rc1 (2018-09-17)
|
||||||
|
==============================
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Python 3.5 and 3.6 support is now in beta. ([\#3576](https://github.com/matrix-org/synapse/issues/3576))
|
||||||
|
- Implement `event_format` filter param in `/sync` ([\#3790](https://github.com/matrix-org/synapse/issues/3790))
|
||||||
|
- Add synapse_admin_mau:registered_reserved_users metric to expose number of real reaserved users ([\#3846](https://github.com/matrix-org/synapse/issues/3846))
|
||||||
|
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Remove connection ID for replication prometheus metrics, as it creates a large number of new series. ([\#3788](https://github.com/matrix-org/synapse/issues/3788))
|
||||||
|
- guest users should not be part of mau total ([\#3800](https://github.com/matrix-org/synapse/issues/3800))
|
||||||
|
- Bump dependency on pyopenssl 16.x, to avoid incompatibility with recent Twisted. ([\#3804](https://github.com/matrix-org/synapse/issues/3804))
|
||||||
|
- Fix existing room tags not coming down sync when joining a room ([\#3810](https://github.com/matrix-org/synapse/issues/3810))
|
||||||
|
- Fix jwt import check ([\#3824](https://github.com/matrix-org/synapse/issues/3824))
|
||||||
|
- fix VOIP crashes under Python 3 (#3821) ([\#3835](https://github.com/matrix-org/synapse/issues/3835))
|
||||||
|
- Fix manhole so that it works with latest openssh clients ([\#3841](https://github.com/matrix-org/synapse/issues/3841))
|
||||||
|
- Fix outbound requests occasionally wedging, which can result in federation breaking between servers. ([\#3845](https://github.com/matrix-org/synapse/issues/3845))
|
||||||
|
- Show heroes if room name/canonical alias has been deleted ([\#3851](https://github.com/matrix-org/synapse/issues/3851))
|
||||||
|
- Fix handling of redacted events from federation ([\#3859](https://github.com/matrix-org/synapse/issues/3859))
|
||||||
|
- ([\#3874](https://github.com/matrix-org/synapse/issues/3874))
|
||||||
|
- Mitigate outbound federation randomly becoming wedged ([\#3875](https://github.com/matrix-org/synapse/issues/3875))
|
||||||
|
|
||||||
|
|
||||||
|
Internal Changes
|
||||||
|
----------------
|
||||||
|
|
||||||
|
- CircleCI tests now run on the potential merge of a PR. ([\#3704](https://github.com/matrix-org/synapse/issues/3704))
|
||||||
|
- http/ is now ported to Python 3. ([\#3771](https://github.com/matrix-org/synapse/issues/3771))
|
||||||
|
- Improve human readable error messages for threepid registration/account update ([\#3789](https://github.com/matrix-org/synapse/issues/3789))
|
||||||
|
- Make /sync slightly faster by avoiding needless copies ([\#3795](https://github.com/matrix-org/synapse/issues/3795))
|
||||||
|
- handlers/ is now ported to Python 3. ([\#3803](https://github.com/matrix-org/synapse/issues/3803))
|
||||||
|
- Limit the number of PDUs/EDUs per federation transaction ([\#3805](https://github.com/matrix-org/synapse/issues/3805))
|
||||||
|
- Only start postgres instance for postgres tests on Travis CI ([\#3806](https://github.com/matrix-org/synapse/issues/3806))
|
||||||
|
- tests/ is now ported to Python 3. ([\#3808](https://github.com/matrix-org/synapse/issues/3808))
|
||||||
|
- crypto/ is now ported to Python 3. ([\#3822](https://github.com/matrix-org/synapse/issues/3822))
|
||||||
|
- rest/ is now ported to Python 3. ([\#3823](https://github.com/matrix-org/synapse/issues/3823))
|
||||||
|
- add some logging for the keyring queue ([\#3826](https://github.com/matrix-org/synapse/issues/3826))
|
||||||
|
- speed up lazy loading by 2-3x ([\#3827](https://github.com/matrix-org/synapse/issues/3827))
|
||||||
|
- Improved Dockerfile to remove build requirements after building reducing the image size. ([\#3834](https://github.com/matrix-org/synapse/issues/3834))
|
||||||
|
- Disable lazy loading for incremental syncs for now ([\#3840](https://github.com/matrix-org/synapse/issues/3840))
|
||||||
|
- federation/ is now ported to Python 3. ([\#3847](https://github.com/matrix-org/synapse/issues/3847))
|
||||||
|
- Log when we retry outbound requests ([\#3853](https://github.com/matrix-org/synapse/issues/3853))
|
||||||
|
- Removed some excess logging messages. ([\#3855](https://github.com/matrix-org/synapse/issues/3855))
|
||||||
|
- Speed up purge history for rooms that have been previously purged ([\#3856](https://github.com/matrix-org/synapse/issues/3856))
|
||||||
|
- Refactor some HTTP timeout code. ([\#3857](https://github.com/matrix-org/synapse/issues/3857))
|
||||||
|
- Fix running merged builds on CircleCI ([\#3858](https://github.com/matrix-org/synapse/issues/3858))
|
||||||
|
- Fix typo in replication stream exception. ([\#3860](https://github.com/matrix-org/synapse/issues/3860))
|
||||||
|
- Add in flight real time metrics for Measure blocks ([\#3871](https://github.com/matrix-org/synapse/issues/3871))
|
||||||
|
- Disable buffering and automatic retrying in treq requests to prevent timeouts. ([\#3872](https://github.com/matrix-org/synapse/issues/3872))
|
||||||
|
- mention jemalloc in the README ([\#3877](https://github.com/matrix-org/synapse/issues/3877))
|
||||||
|
- Remove unmaintained "nuke-room-from-db.sh" script ([\#3888](https://github.com/matrix-org/synapse/issues/3888))
|
||||||
|
|
||||||
|
|
||||||
Synapse 0.33.4 (2018-09-07)
|
Synapse 0.33.4 (2018-09-07)
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
|
|
@ -30,12 +30,28 @@ 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
|
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.
|
changes will then land on master when we next do a release.
|
||||||
|
|
||||||
We use `Jenkins <http://matrix.org/jenkins>`_ and
|
We use `CircleCI <https://circleci.com/gh/matrix-org>`_ and `Travis CI
|
||||||
`Travis <https://travis-ci.org/matrix-org/synapse>`_ for continuous
|
<https://travis-ci.org/matrix-org/synapse>`_ for continuous integration. All
|
||||||
integration. All pull requests to synapse get automatically tested by Travis;
|
pull requests to synapse get automatically tested by Travis and CircleCI.
|
||||||
the Jenkins builds require an adminstrator to start them. If your change
|
If your change breaks the build, this will be shown in GitHub, so please
|
||||||
breaks the build, this will be shown in github, so please keep an eye on the
|
keep an eye on the pull request for feedback.
|
||||||
pull request for feedback.
|
|
||||||
|
To run unit tests in a local development environment, you can use:
|
||||||
|
|
||||||
|
- ``tox -e py27`` (requires tox to be installed by ``pip install tox``) for
|
||||||
|
SQLite-backed Synapse on Python 2.7.
|
||||||
|
- ``tox -e py35`` for SQLite-backed Synapse on Python 3.5.
|
||||||
|
- ``tox -e py36`` for SQLite-backed Synapse on Python 3.6.
|
||||||
|
- ``tox -e py27-postgres`` for PostgreSQL-backed Synapse on Python 2.7
|
||||||
|
(requires a running local PostgreSQL with access to create databases).
|
||||||
|
- ``./test_postgresql.sh`` for PostgreSQL-backed Synapse on Python 2.7
|
||||||
|
(requires Docker). Entirely self-contained, recommended if you don't want to
|
||||||
|
set up PostgreSQL yourself.
|
||||||
|
|
||||||
|
Docker images are available for running the integration tests (SyTest) locally,
|
||||||
|
see the `documentation in the SyTest repo
|
||||||
|
<https://github.com/matrix-org/sytest/blob/develop/docker/README.md>`_ for more
|
||||||
|
information.
|
||||||
|
|
||||||
Code style
|
Code style
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
|
@ -77,7 +93,8 @@ AUTHORS.rst file for the project in question. Please feel free to include a
|
||||||
change to AUTHORS.rst in your pull request to list yourself and a short
|
change to AUTHORS.rst in your pull request to list yourself and a short
|
||||||
description of the area(s) you've worked on. Also, we sometimes have swag to
|
description of the area(s) you've worked on. Also, we sometimes have swag to
|
||||||
give away to contributors - if you feel that Matrix-branded apparel is missing
|
give away to contributors - if you feel that Matrix-branded apparel is missing
|
||||||
from your life, please mail us your shipping address to matrix at matrix.org and we'll try to fix it :)
|
from your life, please mail us your shipping address to matrix at matrix.org and
|
||||||
|
we'll try to fix it :)
|
||||||
|
|
||||||
Sign off
|
Sign off
|
||||||
~~~~~~~~
|
~~~~~~~~
|
||||||
|
@ -144,4 +161,9 @@ flag to ``git commit``, which uses the name and email set in your
|
||||||
Conclusion
|
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!
|
||||||
|
|
|
@ -28,6 +28,7 @@ exclude jenkins*.sh
|
||||||
exclude jenkins*
|
exclude jenkins*
|
||||||
exclude Dockerfile
|
exclude Dockerfile
|
||||||
exclude .dockerignore
|
exclude .dockerignore
|
||||||
|
exclude test_postgresql.sh
|
||||||
recursive-exclude jenkins *.sh
|
recursive-exclude jenkins *.sh
|
||||||
|
|
||||||
include pyproject.toml
|
include pyproject.toml
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Python 3.5+ is now supported.
|
|
1
changelog.d/3578.bugfix
Normal file
1
changelog.d/3578.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix problem when playing media from Chrome using direct URL (thanks @remjey!)
|
2
changelog.d/3699.misc
Normal file
2
changelog.d/3699.misc
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
Unit tests can now be run under PostgreSQL in Docker using
|
||||||
|
``test_postgresql.sh``.
|
|
@ -1 +0,0 @@
|
||||||
CircleCI tests now run on the potential merge of a PR.
|
|
|
@ -1 +0,0 @@
|
||||||
http/ is now ported to Python 3.
|
|
|
@ -1 +0,0 @@
|
||||||
Remove connection ID for replication prometheus metrics, as it creates a large number of new series.
|
|
|
@ -1 +0,0 @@
|
||||||
Improve human readable error messages for threepid registration/account update
|
|
|
@ -1 +0,0 @@
|
||||||
Implement `event_format` filter param in `/sync`
|
|
1
changelog.d/3794.misc
Normal file
1
changelog.d/3794.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Speed up calculation of typing updates for replication
|
|
@ -1 +0,0 @@
|
||||||
Make /sync slightly faster by avoiding needless copies
|
|
|
@ -1 +0,0 @@
|
||||||
guest users should not be part of mau total
|
|
|
@ -1 +0,0 @@
|
||||||
handlers/ is now ported to Python 3.
|
|
|
@ -1 +0,0 @@
|
||||||
Bump dependency on pyopenssl 16.x, to avoid incompatibility with recent Twisted.
|
|
|
@ -1 +0,0 @@
|
||||||
Limit the number of PDUs/EDUs per federation transaction
|
|
|
@ -1 +0,0 @@
|
||||||
Only start postgres instance for postgres tests on Travis CI
|
|
|
@ -1 +0,0 @@
|
||||||
tests/ is now ported to Python 3.
|
|
|
@ -1 +0,0 @@
|
||||||
Fix existing room tags not coming down sync when joining a room
|
|
|
@ -1 +0,0 @@
|
||||||
crypto/ is now ported to Python 3.
|
|
|
@ -1 +0,0 @@
|
||||||
rest/ is now ported to Python 3.
|
|
|
@ -1 +0,0 @@
|
||||||
Fix jwt import check
|
|
|
@ -1 +0,0 @@
|
||||||
add some logging for the keyring queue
|
|
|
@ -1 +0,0 @@
|
||||||
speed up lazy loading by 2-3x
|
|
|
@ -1 +0,0 @@
|
||||||
Improved Dockerfile to remove build requirements after building reducing the image size.
|
|
|
@ -1 +0,0 @@
|
||||||
fix VOIP crashes under Python 3 (#3821)
|
|
|
@ -1 +0,0 @@
|
||||||
Disable lazy loading for incremental syncs for now
|
|
|
@ -1 +0,0 @@
|
||||||
Fix manhole so that it works with latest openssh clients
|
|
|
@ -1 +0,0 @@
|
||||||
Fix outbound requests occasionally wedging, which can result in federation breaking between servers.
|
|
|
@ -1 +0,0 @@
|
||||||
Add synapse_admin_mau:registered_reserved_users metric to expose number of real reaserved users
|
|
|
@ -1 +0,0 @@
|
||||||
federation/ is now ported to Python 3.
|
|
|
@ -1 +0,0 @@
|
||||||
Show heroes if room name/canonical alias has been deleted
|
|
|
@ -1 +0,0 @@
|
||||||
Log when we retry outbound requests
|
|
|
@ -1 +0,0 @@
|
||||||
Removed some excess logging messages.
|
|
|
@ -1 +0,0 @@
|
||||||
Speed up purge history for rooms that have been previously purged
|
|
|
@ -1 +0,0 @@
|
||||||
Refactor some HTTP timeout code.
|
|
|
@ -1 +0,0 @@
|
||||||
Fix running merged builds on CircleCI
|
|
|
@ -1 +0,0 @@
|
||||||
Fix handling of redacted events from federation
|
|
|
@ -1 +0,0 @@
|
||||||
Fix typo in replication stream exception.
|
|
1
changelog.d/3868.bugfix
Normal file
1
changelog.d/3868.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix broken invite email links for self hosted riots
|
|
@ -1 +0,0 @@
|
||||||
Add in flight real time metrics for Measure blocks
|
|
|
@ -1 +0,0 @@
|
||||||
Disable buffering and automatic retrying in treq requests to prevent timeouts.
|
|
|
@ -1 +0,0 @@
|
||||||
Mitigate outbound federation randomly becoming wedged
|
|
|
@ -1 +0,0 @@
|
||||||
mention jemalloc in the README
|
|
|
@ -1 +0,0 @@
|
||||||
Remove unmaintained "nuke-room-from-db.sh" script
|
|
1
changelog.d/3904.misc
Normal file
1
changelog.d/3904.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Improve the logging when handling a federation transaction
|
1
changelog.d/3908.bugfix
Normal file
1
changelog.d/3908.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix adding client IPs to the database failing on Python 3.
|
1
changelog.d/3911.misc
Normal file
1
changelog.d/3911.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix the docker image building on python 3
|
1
changelog.d/3912.misc
Normal file
1
changelog.d/3912.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Add a regression test for logging failed HTTP requests on Python 3.
|
1
changelog.d/3914.bugfix
Normal file
1
changelog.d/3914.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix bug where outbound federation would stop talking to some servers when using workers
|
1
changelog.d/3916.feature
Normal file
1
changelog.d/3916.feature
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Always LL ourselves if we're in a room
|
1
changelog.d/3924.misc
Normal file
1
changelog.d/3924.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Comments and interface cleanup for on_receive_pdu
|
1
changelog.d/3925.misc
Normal file
1
changelog.d/3925.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix spurious exceptions when remote http client closes conncetion
|
1
changelog.d/3927.misc
Normal file
1
changelog.d/3927.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Log exceptions thrown by background tasks
|
1
changelog.d/3932.bugfix
Normal file
1
changelog.d/3932.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix some instances of ExpiringCache not expiring cache items
|
1
changelog.d/3936.bugfix
Normal file
1
changelog.d/3936.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix out-of-bounds error when LLing yourself
|
1
changelog.d/3946.misc
Normal file
1
changelog.d/3946.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Automate pushes to docker hub
|
1
changelog.d/3947.misc
Normal file
1
changelog.d/3947.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Require attrs 16.0.0 or later
|
1
changelog.d/3948.misc
Normal file
1
changelog.d/3948.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix incompatibility with python3 on alpine
|
1
changelog.d/3952.misc
Normal file
1
changelog.d/3952.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Run the test suite on the oldest supported versions of our dependencies in CI.
|
1
changelog.d/3956.bugfix
Normal file
1
changelog.d/3956.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix exceptions from metrics handler
|
1
changelog.d/3957.misc
Normal file
1
changelog.d/3957.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
CircleCI now only runs merged jobs on PRs, and commit jobs on develop, master, and release branches.
|
1
changelog.d/3958.misc
Normal file
1
changelog.d/3958.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix docstrings and add tests for state store methods
|
1
changelog.d/3959.feature
Normal file
1
changelog.d/3959.feature
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Include eventid in log lines when processing incoming federation transactions
|
1
changelog.d/3961.bugfix
Normal file
1
changelog.d/3961.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix errors due to concurrent monthly_active_user upserts
|
1
changelog.d/3963.misc
Normal file
1
changelog.d/3963.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
fix docstring for FederationClient.get_state_for_room
|
1
changelog.d/3965.misc
Normal file
1
changelog.d/3965.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Run notify_app_services as a bg process
|
1
changelog.d/3966.misc
Normal file
1
changelog.d/3966.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Improve the logging when handling a federation transaction
|
1
changelog.d/3967.misc
Normal file
1
changelog.d/3967.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Clarifications in FederationHandler
|
1
changelog.d/3970.bugfix
Normal file
1
changelog.d/3970.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Replaced all occurences of e.message with str(e). Contributed by Schnuffle
|
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,5 @@
|
||||||
FROM docker.io/python:2-alpine3.8
|
ARG PYTHON_VERSION=2
|
||||||
|
FROM docker.io/python:${PYTHON_VERSION}-alpine3.8
|
||||||
|
|
||||||
COPY . /synapse
|
COPY . /synapse
|
||||||
|
|
||||||
|
|
12
docker/Dockerfile-pgtests
Normal file
12
docker/Dockerfile-pgtests
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# Use the Sytest image that comes with a lot of the build dependencies
|
||||||
|
# pre-installed
|
||||||
|
FROM matrixdotorg/sytest:latest
|
||||||
|
|
||||||
|
# The Sytest image doesn't come with python, so install that
|
||||||
|
RUN apt-get -qq install -y python python-dev python-pip
|
||||||
|
|
||||||
|
# We need tox to run the tests in run_pg_tests.sh
|
||||||
|
RUN pip install tox
|
||||||
|
|
||||||
|
ADD run_pg_tests.sh /pg_tests.sh
|
||||||
|
ENTRYPOINT /pg_tests.sh
|
20
docker/run_pg_tests.sh
Executable file
20
docker/run_pg_tests.sh
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# This script runs the PostgreSQL tests inside a Docker container. It expects
|
||||||
|
# the relevant source files to be mounted into /src (done automatically by the
|
||||||
|
# caller script). It will set up the database, run it, and then use the tox
|
||||||
|
# configuration to run the tests.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Set PGUSER so Synapse's tests know what user to connect to the database with
|
||||||
|
export PGUSER=postgres
|
||||||
|
|
||||||
|
# Initialise & start the database
|
||||||
|
su -c '/usr/lib/postgresql/9.6/bin/initdb -D /var/lib/postgresql/data -E "UTF-8" --lc-collate="en_US.UTF-8" --lc-ctype="en_US.UTF-8" --username=postgres' postgres
|
||||||
|
su -c '/usr/lib/postgresql/9.6/bin/pg_ctl -w -D /var/lib/postgresql/data start' postgres
|
||||||
|
|
||||||
|
# Run the tests
|
||||||
|
cd /src
|
||||||
|
export TRIAL_FLAGS="-j 4"
|
||||||
|
tox --workdir=/tmp -e py27-postgres
|
|
@ -5,6 +5,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import glob
|
import glob
|
||||||
|
import codecs
|
||||||
|
|
||||||
# Utility functions
|
# Utility functions
|
||||||
convert = lambda src, dst, environ: open(dst, "w").write(jinja2.Template(open(src).read()).render(**environ))
|
convert = lambda src, dst, environ: open(dst, "w").write(jinja2.Template(open(src).read()).render(**environ))
|
||||||
|
@ -23,7 +24,7 @@ def generate_secrets(environ, secrets):
|
||||||
with open(filename) as handle: value = handle.read()
|
with open(filename) as handle: value = handle.read()
|
||||||
else:
|
else:
|
||||||
print("Generating a random secret for {}".format(name))
|
print("Generating a random secret for {}".format(name))
|
||||||
value = os.urandom(32).encode("hex")
|
value = codecs.encode(os.urandom(32), "hex").decode()
|
||||||
with open(filename, "w") as handle: handle.write(value)
|
with open(filename, "w") as handle: handle.write(value)
|
||||||
environ[secret] = value
|
environ[secret] = value
|
||||||
|
|
||||||
|
|
|
@ -21,4 +21,4 @@ try:
|
||||||
verifier.verify(macaroon, key)
|
verifier.verify(macaroon, key)
|
||||||
print "Signature is correct"
|
print "Signature is correct"
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print e.message
|
print str(e)
|
||||||
|
|
9
scripts-dev/next_github_number.sh
Executable file
9
scripts-dev/next_github_number.sh
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Fetch the current GitHub issue number, add one to it -- presto! The likely
|
||||||
|
# next PR number.
|
||||||
|
CURRENT_NUMBER=`curl -s "https://api.github.com/repos/matrix-org/synapse/issues?state=all&per_page=1" | jq -r ".[0].number"`
|
||||||
|
CURRENT_NUMBER=$((CURRENT_NUMBER+1))
|
||||||
|
echo $CURRENT_NUMBER
|
|
@ -27,4 +27,4 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
__version__ = "0.33.4"
|
__version__ = "0.33.5.1"
|
||||||
|
|
|
@ -226,7 +226,7 @@ class Filtering(object):
|
||||||
jsonschema.validate(user_filter_json, USER_FILTER_SCHEMA,
|
jsonschema.validate(user_filter_json, USER_FILTER_SCHEMA,
|
||||||
format_checker=FormatChecker())
|
format_checker=FormatChecker())
|
||||||
except jsonschema.ValidationError as e:
|
except jsonschema.ValidationError as e:
|
||||||
raise SynapseError(400, e.message)
|
raise SynapseError(400, str(e))
|
||||||
|
|
||||||
|
|
||||||
class FilterCollection(object):
|
class FilterCollection(object):
|
||||||
|
|
|
@ -24,7 +24,7 @@ try:
|
||||||
python_dependencies.check_requirements()
|
python_dependencies.check_requirements()
|
||||||
except python_dependencies.MissingRequirementError as e:
|
except python_dependencies.MissingRequirementError as e:
|
||||||
message = "\n".join([
|
message = "\n".join([
|
||||||
"Missing Requirement: %s" % (e.message,),
|
"Missing Requirement: %s" % (str(e),),
|
||||||
"To install run:",
|
"To install run:",
|
||||||
" pip install --upgrade --force \"%s\"" % (e.dependency,),
|
" pip install --upgrade --force \"%s\"" % (e.dependency,),
|
||||||
"",
|
"",
|
||||||
|
|
|
@ -136,7 +136,7 @@ def start(config_options):
|
||||||
"Synapse appservice", config_options
|
"Synapse appservice", config_options
|
||||||
)
|
)
|
||||||
except ConfigError as e:
|
except ConfigError as e:
|
||||||
sys.stderr.write("\n" + e.message + "\n")
|
sys.stderr.write("\n" + str(e) + "\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
assert config.worker_app == "synapse.app.appservice"
|
assert config.worker_app == "synapse.app.appservice"
|
||||||
|
@ -172,7 +172,6 @@ def start(config_options):
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
ps.get_datastore().start_profiling()
|
ps.get_datastore().start_profiling()
|
||||||
ps.get_state_handler().start_caching()
|
|
||||||
|
|
||||||
reactor.callWhenRunning(start)
|
reactor.callWhenRunning(start)
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ def start(config_options):
|
||||||
"Synapse client reader", config_options
|
"Synapse client reader", config_options
|
||||||
)
|
)
|
||||||
except ConfigError as e:
|
except ConfigError as e:
|
||||||
sys.stderr.write("\n" + e.message + "\n")
|
sys.stderr.write("\n" + str(e) + "\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
assert config.worker_app == "synapse.app.client_reader"
|
assert config.worker_app == "synapse.app.client_reader"
|
||||||
|
@ -181,7 +181,6 @@ def start(config_options):
|
||||||
ss.start_listening(config.worker_listeners)
|
ss.start_listening(config.worker_listeners)
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
ss.get_state_handler().start_caching()
|
|
||||||
ss.get_datastore().start_profiling()
|
ss.get_datastore().start_profiling()
|
||||||
|
|
||||||
reactor.callWhenRunning(start)
|
reactor.callWhenRunning(start)
|
||||||
|
|
|
@ -169,7 +169,7 @@ def start(config_options):
|
||||||
"Synapse event creator", config_options
|
"Synapse event creator", config_options
|
||||||
)
|
)
|
||||||
except ConfigError as e:
|
except ConfigError as e:
|
||||||
sys.stderr.write("\n" + e.message + "\n")
|
sys.stderr.write("\n" + str(e) + "\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
assert config.worker_app == "synapse.app.event_creator"
|
assert config.worker_app == "synapse.app.event_creator"
|
||||||
|
@ -199,7 +199,6 @@ def start(config_options):
|
||||||
ss.start_listening(config.worker_listeners)
|
ss.start_listening(config.worker_listeners)
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
ss.get_state_handler().start_caching()
|
|
||||||
ss.get_datastore().start_profiling()
|
ss.get_datastore().start_profiling()
|
||||||
|
|
||||||
reactor.callWhenRunning(start)
|
reactor.callWhenRunning(start)
|
||||||
|
|
|
@ -140,7 +140,7 @@ def start(config_options):
|
||||||
"Synapse federation reader", config_options
|
"Synapse federation reader", config_options
|
||||||
)
|
)
|
||||||
except ConfigError as e:
|
except ConfigError as e:
|
||||||
sys.stderr.write("\n" + e.message + "\n")
|
sys.stderr.write("\n" + str(e) + "\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
assert config.worker_app == "synapse.app.federation_reader"
|
assert config.worker_app == "synapse.app.federation_reader"
|
||||||
|
@ -168,7 +168,6 @@ def start(config_options):
|
||||||
ss.start_listening(config.worker_listeners)
|
ss.start_listening(config.worker_listeners)
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
ss.get_state_handler().start_caching()
|
|
||||||
ss.get_datastore().start_profiling()
|
ss.get_datastore().start_profiling()
|
||||||
|
|
||||||
reactor.callWhenRunning(start)
|
reactor.callWhenRunning(start)
|
||||||
|
|
|
@ -160,7 +160,7 @@ def start(config_options):
|
||||||
"Synapse federation sender", config_options
|
"Synapse federation sender", config_options
|
||||||
)
|
)
|
||||||
except ConfigError as e:
|
except ConfigError as e:
|
||||||
sys.stderr.write("\n" + e.message + "\n")
|
sys.stderr.write("\n" + str(e) + "\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
assert config.worker_app == "synapse.app.federation_sender"
|
assert config.worker_app == "synapse.app.federation_sender"
|
||||||
|
@ -201,7 +201,6 @@ def start(config_options):
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
ps.get_datastore().start_profiling()
|
ps.get_datastore().start_profiling()
|
||||||
ps.get_state_handler().start_caching()
|
|
||||||
|
|
||||||
reactor.callWhenRunning(start)
|
reactor.callWhenRunning(start)
|
||||||
_base.start_worker_reactor("synapse-federation-sender", config)
|
_base.start_worker_reactor("synapse-federation-sender", config)
|
||||||
|
|
|
@ -228,7 +228,7 @@ def start(config_options):
|
||||||
"Synapse frontend proxy", config_options
|
"Synapse frontend proxy", config_options
|
||||||
)
|
)
|
||||||
except ConfigError as e:
|
except ConfigError as e:
|
||||||
sys.stderr.write("\n" + e.message + "\n")
|
sys.stderr.write("\n" + str(e) + "\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
assert config.worker_app == "synapse.app.frontend_proxy"
|
assert config.worker_app == "synapse.app.frontend_proxy"
|
||||||
|
@ -258,7 +258,6 @@ def start(config_options):
|
||||||
ss.start_listening(config.worker_listeners)
|
ss.start_listening(config.worker_listeners)
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
ss.get_state_handler().start_caching()
|
|
||||||
ss.get_datastore().start_profiling()
|
ss.get_datastore().start_profiling()
|
||||||
|
|
||||||
reactor.callWhenRunning(start)
|
reactor.callWhenRunning(start)
|
||||||
|
|
|
@ -301,7 +301,7 @@ class SynapseHomeServer(HomeServer):
|
||||||
try:
|
try:
|
||||||
database_engine.check_database(db_conn.cursor())
|
database_engine.check_database(db_conn.cursor())
|
||||||
except IncorrectDatabaseSetup as e:
|
except IncorrectDatabaseSetup as e:
|
||||||
quit_with_error(e.message)
|
quit_with_error(str(e))
|
||||||
|
|
||||||
|
|
||||||
# Gauges to expose monthly active user control metrics
|
# Gauges to expose monthly active user control metrics
|
||||||
|
@ -328,7 +328,7 @@ def setup(config_options):
|
||||||
config_options,
|
config_options,
|
||||||
)
|
)
|
||||||
except ConfigError as e:
|
except ConfigError as e:
|
||||||
sys.stderr.write("\n" + e.message + "\n")
|
sys.stderr.write("\n" + str(e) + "\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if not config:
|
if not config:
|
||||||
|
@ -384,7 +384,6 @@ def setup(config_options):
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
hs.get_pusherpool().start()
|
hs.get_pusherpool().start()
|
||||||
hs.get_state_handler().start_caching()
|
|
||||||
hs.get_datastore().start_profiling()
|
hs.get_datastore().start_profiling()
|
||||||
hs.get_datastore().start_doing_background_updates()
|
hs.get_datastore().start_doing_background_updates()
|
||||||
hs.get_federation_client().start_get_pdu_cache()
|
hs.get_federation_client().start_get_pdu_cache()
|
||||||
|
|
|
@ -133,7 +133,7 @@ def start(config_options):
|
||||||
"Synapse media repository", config_options
|
"Synapse media repository", config_options
|
||||||
)
|
)
|
||||||
except ConfigError as e:
|
except ConfigError as e:
|
||||||
sys.stderr.write("\n" + e.message + "\n")
|
sys.stderr.write("\n" + str(e) + "\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
assert config.worker_app == "synapse.app.media_repository"
|
assert config.worker_app == "synapse.app.media_repository"
|
||||||
|
@ -168,7 +168,6 @@ def start(config_options):
|
||||||
ss.start_listening(config.worker_listeners)
|
ss.start_listening(config.worker_listeners)
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
ss.get_state_handler().start_caching()
|
|
||||||
ss.get_datastore().start_profiling()
|
ss.get_datastore().start_profiling()
|
||||||
|
|
||||||
reactor.callWhenRunning(start)
|
reactor.callWhenRunning(start)
|
||||||
|
|
|
@ -191,7 +191,7 @@ def start(config_options):
|
||||||
"Synapse pusher", config_options
|
"Synapse pusher", config_options
|
||||||
)
|
)
|
||||||
except ConfigError as e:
|
except ConfigError as e:
|
||||||
sys.stderr.write("\n" + e.message + "\n")
|
sys.stderr.write("\n" + str(e) + "\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
assert config.worker_app == "synapse.app.pusher"
|
assert config.worker_app == "synapse.app.pusher"
|
||||||
|
@ -228,7 +228,6 @@ def start(config_options):
|
||||||
def start():
|
def start():
|
||||||
ps.get_pusherpool().start()
|
ps.get_pusherpool().start()
|
||||||
ps.get_datastore().start_profiling()
|
ps.get_datastore().start_profiling()
|
||||||
ps.get_state_handler().start_caching()
|
|
||||||
|
|
||||||
reactor.callWhenRunning(start)
|
reactor.callWhenRunning(start)
|
||||||
|
|
||||||
|
|
|
@ -410,7 +410,7 @@ def start(config_options):
|
||||||
"Synapse synchrotron", config_options
|
"Synapse synchrotron", config_options
|
||||||
)
|
)
|
||||||
except ConfigError as e:
|
except ConfigError as e:
|
||||||
sys.stderr.write("\n" + e.message + "\n")
|
sys.stderr.write("\n" + str(e) + "\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
assert config.worker_app == "synapse.app.synchrotron"
|
assert config.worker_app == "synapse.app.synchrotron"
|
||||||
|
@ -435,7 +435,6 @@ def start(config_options):
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
ss.get_datastore().start_profiling()
|
ss.get_datastore().start_profiling()
|
||||||
ss.get_state_handler().start_caching()
|
|
||||||
|
|
||||||
reactor.callWhenRunning(start)
|
reactor.callWhenRunning(start)
|
||||||
|
|
||||||
|
|
|
@ -1,284 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright 2014-2016 OpenMarket Ltd
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import collections
|
|
||||||
import errno
|
|
||||||
import glob
|
|
||||||
import os
|
|
||||||
import os.path
|
|
||||||
import signal
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
import time
|
|
||||||
|
|
||||||
from six import iteritems
|
|
||||||
|
|
||||||
import yaml
|
|
||||||
|
|
||||||
SYNAPSE = [sys.executable, "-B", "-m", "synapse.app.homeserver"]
|
|
||||||
|
|
||||||
GREEN = "\x1b[1;32m"
|
|
||||||
YELLOW = "\x1b[1;33m"
|
|
||||||
RED = "\x1b[1;31m"
|
|
||||||
NORMAL = "\x1b[m"
|
|
||||||
|
|
||||||
|
|
||||||
def pid_running(pid):
|
|
||||||
try:
|
|
||||||
os.kill(pid, 0)
|
|
||||||
return True
|
|
||||||
except OSError as err:
|
|
||||||
if err.errno == errno.EPERM:
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def write(message, colour=NORMAL, stream=sys.stdout):
|
|
||||||
if colour == NORMAL:
|
|
||||||
stream.write(message + "\n")
|
|
||||||
else:
|
|
||||||
stream.write(colour + message + NORMAL + "\n")
|
|
||||||
|
|
||||||
|
|
||||||
def abort(message, colour=RED, stream=sys.stderr):
|
|
||||||
write(message, colour, stream)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
def start(configfile):
|
|
||||||
write("Starting ...")
|
|
||||||
args = SYNAPSE
|
|
||||||
args.extend(["--daemonize", "-c", configfile])
|
|
||||||
|
|
||||||
try:
|
|
||||||
subprocess.check_call(args)
|
|
||||||
write("started synapse.app.homeserver(%r)" %
|
|
||||||
(configfile,), colour=GREEN)
|
|
||||||
except subprocess.CalledProcessError as e:
|
|
||||||
write(
|
|
||||||
"error starting (exit code: %d); see above for logs" % e.returncode,
|
|
||||||
colour=RED,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def start_worker(app, configfile, worker_configfile):
|
|
||||||
args = [
|
|
||||||
"python", "-B",
|
|
||||||
"-m", app,
|
|
||||||
"-c", configfile,
|
|
||||||
"-c", worker_configfile
|
|
||||||
]
|
|
||||||
|
|
||||||
try:
|
|
||||||
subprocess.check_call(args)
|
|
||||||
write("started %s(%r)" % (app, worker_configfile), colour=GREEN)
|
|
||||||
except subprocess.CalledProcessError as e:
|
|
||||||
write(
|
|
||||||
"error starting %s(%r) (exit code: %d); see above for logs" % (
|
|
||||||
app, worker_configfile, e.returncode,
|
|
||||||
),
|
|
||||||
colour=RED,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def stop(pidfile, app):
|
|
||||||
if os.path.exists(pidfile):
|
|
||||||
pid = int(open(pidfile).read())
|
|
||||||
try:
|
|
||||||
os.kill(pid, signal.SIGTERM)
|
|
||||||
write("stopped %s" % (app,), colour=GREEN)
|
|
||||||
except OSError as err:
|
|
||||||
if err.errno == errno.ESRCH:
|
|
||||||
write("%s not running" % (app,), colour=YELLOW)
|
|
||||||
elif err.errno == errno.EPERM:
|
|
||||||
abort("Cannot stop %s: Operation not permitted" % (app,))
|
|
||||||
else:
|
|
||||||
abort("Cannot stop %s: Unknown error" % (app,))
|
|
||||||
|
|
||||||
|
|
||||||
Worker = collections.namedtuple("Worker", [
|
|
||||||
"app", "configfile", "pidfile", "cache_factor"
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
|
||||||
|
|
||||||
parser.add_argument(
|
|
||||||
"action",
|
|
||||||
choices=["start", "stop", "restart"],
|
|
||||||
help="whether to start, stop or restart the synapse",
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
|
||||||
"configfile",
|
|
||||||
nargs="?",
|
|
||||||
default="homeserver.yaml",
|
|
||||||
help="the homeserver config file, defaults to homeserver.yaml",
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
|
||||||
"-w", "--worker",
|
|
||||||
metavar="WORKERCONFIG",
|
|
||||||
help="start or stop a single worker",
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
|
||||||
"-a", "--all-processes",
|
|
||||||
metavar="WORKERCONFIGDIR",
|
|
||||||
help="start or stop all the workers in the given directory"
|
|
||||||
" and the main synapse process",
|
|
||||||
)
|
|
||||||
|
|
||||||
options = parser.parse_args()
|
|
||||||
|
|
||||||
if options.worker and options.all_processes:
|
|
||||||
write(
|
|
||||||
'Cannot use "--worker" with "--all-processes"',
|
|
||||||
stream=sys.stderr
|
|
||||||
)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
configfile = options.configfile
|
|
||||||
|
|
||||||
if not os.path.exists(configfile):
|
|
||||||
write(
|
|
||||||
"No config file found\n"
|
|
||||||
"To generate a config file, run '%s -c %s --generate-config"
|
|
||||||
" --server-name=<server name>'\n" % (
|
|
||||||
" ".join(SYNAPSE), options.configfile
|
|
||||||
),
|
|
||||||
stream=sys.stderr,
|
|
||||||
)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
with open(configfile) as stream:
|
|
||||||
config = yaml.load(stream)
|
|
||||||
|
|
||||||
pidfile = config["pid_file"]
|
|
||||||
cache_factor = config.get("synctl_cache_factor")
|
|
||||||
start_stop_synapse = True
|
|
||||||
|
|
||||||
if cache_factor:
|
|
||||||
os.environ["SYNAPSE_CACHE_FACTOR"] = str(cache_factor)
|
|
||||||
|
|
||||||
cache_factors = config.get("synctl_cache_factors", {})
|
|
||||||
for cache_name, factor in iteritems(cache_factors):
|
|
||||||
os.environ["SYNAPSE_CACHE_FACTOR_" + cache_name.upper()] = str(factor)
|
|
||||||
|
|
||||||
worker_configfiles = []
|
|
||||||
if options.worker:
|
|
||||||
start_stop_synapse = False
|
|
||||||
worker_configfile = options.worker
|
|
||||||
if not os.path.exists(worker_configfile):
|
|
||||||
write(
|
|
||||||
"No worker config found at %r" % (worker_configfile,),
|
|
||||||
stream=sys.stderr,
|
|
||||||
)
|
|
||||||
sys.exit(1)
|
|
||||||
worker_configfiles.append(worker_configfile)
|
|
||||||
|
|
||||||
if options.all_processes:
|
|
||||||
# To start the main synapse with -a you need to add a worker file
|
|
||||||
# with worker_app == "synapse.app.homeserver"
|
|
||||||
start_stop_synapse = False
|
|
||||||
worker_configdir = options.all_processes
|
|
||||||
if not os.path.isdir(worker_configdir):
|
|
||||||
write(
|
|
||||||
"No worker config directory found at %r" % (worker_configdir,),
|
|
||||||
stream=sys.stderr,
|
|
||||||
)
|
|
||||||
sys.exit(1)
|
|
||||||
worker_configfiles.extend(sorted(glob.glob(
|
|
||||||
os.path.join(worker_configdir, "*.yaml")
|
|
||||||
)))
|
|
||||||
|
|
||||||
workers = []
|
|
||||||
for worker_configfile in worker_configfiles:
|
|
||||||
with open(worker_configfile) as stream:
|
|
||||||
worker_config = yaml.load(stream)
|
|
||||||
worker_app = worker_config["worker_app"]
|
|
||||||
if worker_app == "synapse.app.homeserver":
|
|
||||||
# We need to special case all of this to pick up options that may
|
|
||||||
# be set in the main config file or in this worker config file.
|
|
||||||
worker_pidfile = (
|
|
||||||
worker_config.get("pid_file")
|
|
||||||
or pidfile
|
|
||||||
)
|
|
||||||
worker_cache_factor = worker_config.get("synctl_cache_factor") or cache_factor
|
|
||||||
daemonize = worker_config.get("daemonize") or config.get("daemonize")
|
|
||||||
assert daemonize, "Main process must have daemonize set to true"
|
|
||||||
|
|
||||||
# The master process doesn't support using worker_* config.
|
|
||||||
for key in worker_config:
|
|
||||||
if key == "worker_app": # But we allow worker_app
|
|
||||||
continue
|
|
||||||
assert not key.startswith("worker_"), \
|
|
||||||
"Main process cannot use worker_* config"
|
|
||||||
else:
|
|
||||||
worker_pidfile = worker_config["worker_pid_file"]
|
|
||||||
worker_daemonize = worker_config["worker_daemonize"]
|
|
||||||
assert worker_daemonize, "In config %r: expected '%s' to be True" % (
|
|
||||||
worker_configfile, "worker_daemonize")
|
|
||||||
worker_cache_factor = worker_config.get("synctl_cache_factor")
|
|
||||||
workers.append(Worker(
|
|
||||||
worker_app, worker_configfile, worker_pidfile, worker_cache_factor,
|
|
||||||
))
|
|
||||||
|
|
||||||
action = options.action
|
|
||||||
|
|
||||||
if action == "stop" or action == "restart":
|
|
||||||
for worker in workers:
|
|
||||||
stop(worker.pidfile, worker.app)
|
|
||||||
|
|
||||||
if start_stop_synapse:
|
|
||||||
stop(pidfile, "synapse.app.homeserver")
|
|
||||||
|
|
||||||
# Wait for synapse to actually shutdown before starting it again
|
|
||||||
if action == "restart":
|
|
||||||
running_pids = []
|
|
||||||
if start_stop_synapse and os.path.exists(pidfile):
|
|
||||||
running_pids.append(int(open(pidfile).read()))
|
|
||||||
for worker in workers:
|
|
||||||
if os.path.exists(worker.pidfile):
|
|
||||||
running_pids.append(int(open(worker.pidfile).read()))
|
|
||||||
if len(running_pids) > 0:
|
|
||||||
write("Waiting for process to exit before restarting...")
|
|
||||||
for running_pid in running_pids:
|
|
||||||
while pid_running(running_pid):
|
|
||||||
time.sleep(0.2)
|
|
||||||
write("All processes exited; now restarting...")
|
|
||||||
|
|
||||||
if action == "start" or action == "restart":
|
|
||||||
if start_stop_synapse:
|
|
||||||
# Check if synapse is already running
|
|
||||||
if os.path.exists(pidfile) and pid_running(int(open(pidfile).read())):
|
|
||||||
abort("synapse.app.homeserver already running")
|
|
||||||
start(configfile)
|
|
||||||
|
|
||||||
for worker in workers:
|
|
||||||
if worker.cache_factor:
|
|
||||||
os.environ["SYNAPSE_CACHE_FACTOR"] = str(worker.cache_factor)
|
|
||||||
|
|
||||||
start_worker(worker.app, configfile, worker.configfile)
|
|
||||||
|
|
||||||
if cache_factor:
|
|
||||||
os.environ["SYNAPSE_CACHE_FACTOR"] = str(cache_factor)
|
|
||||||
else:
|
|
||||||
os.environ.pop("SYNAPSE_CACHE_FACTOR", None)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
|
@ -188,7 +188,7 @@ def start(config_options):
|
||||||
"Synapse user directory", config_options
|
"Synapse user directory", config_options
|
||||||
)
|
)
|
||||||
except ConfigError as e:
|
except ConfigError as e:
|
||||||
sys.stderr.write("\n" + e.message + "\n")
|
sys.stderr.write("\n" + str(e) + "\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
assert config.worker_app == "synapse.app.user_dir"
|
assert config.worker_app == "synapse.app.user_dir"
|
||||||
|
@ -229,7 +229,6 @@ def start(config_options):
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
ps.get_datastore().start_profiling()
|
ps.get_datastore().start_profiling()
|
||||||
ps.get_state_handler().start_caching()
|
|
||||||
|
|
||||||
reactor.callWhenRunning(start)
|
reactor.callWhenRunning(start)
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ if __name__ == "__main__":
|
||||||
try:
|
try:
|
||||||
config = HomeServerConfig.load_config("", sys.argv[3:])
|
config = HomeServerConfig.load_config("", sys.argv[3:])
|
||||||
except ConfigError as e:
|
except ConfigError as e:
|
||||||
sys.stderr.write("\n" + e.message + "\n")
|
sys.stderr.write("\n" + str(e) + "\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
print (getattr(config, key))
|
print (getattr(config, key))
|
||||||
|
|
|
@ -66,6 +66,14 @@ class FederationClient(FederationBase):
|
||||||
self.state = hs.get_state_handler()
|
self.state = hs.get_state_handler()
|
||||||
self.transport_layer = hs.get_federation_transport_client()
|
self.transport_layer = hs.get_federation_transport_client()
|
||||||
|
|
||||||
|
self._get_pdu_cache = ExpiringCache(
|
||||||
|
cache_name="get_pdu_cache",
|
||||||
|
clock=self._clock,
|
||||||
|
max_len=1000,
|
||||||
|
expiry_ms=120 * 1000,
|
||||||
|
reset_expiry_on_get=False,
|
||||||
|
)
|
||||||
|
|
||||||
def _clear_tried_cache(self):
|
def _clear_tried_cache(self):
|
||||||
"""Clear pdu_destination_tried cache"""
|
"""Clear pdu_destination_tried cache"""
|
||||||
now = self._clock.time_msec()
|
now = self._clock.time_msec()
|
||||||
|
@ -82,17 +90,6 @@ class FederationClient(FederationBase):
|
||||||
if destination_dict:
|
if destination_dict:
|
||||||
self.pdu_destination_tried[event_id] = destination_dict
|
self.pdu_destination_tried[event_id] = destination_dict
|
||||||
|
|
||||||
def start_get_pdu_cache(self):
|
|
||||||
self._get_pdu_cache = ExpiringCache(
|
|
||||||
cache_name="get_pdu_cache",
|
|
||||||
clock=self._clock,
|
|
||||||
max_len=1000,
|
|
||||||
expiry_ms=120 * 1000,
|
|
||||||
reset_expiry_on_get=False,
|
|
||||||
)
|
|
||||||
|
|
||||||
self._get_pdu_cache.start()
|
|
||||||
|
|
||||||
@log_function
|
@log_function
|
||||||
def make_query(self, destination, query_type, args,
|
def make_query(self, destination, query_type, args,
|
||||||
retry_on_dns_fail=False, ignore_backoff=False):
|
retry_on_dns_fail=False, ignore_backoff=False):
|
||||||
|
@ -212,8 +209,6 @@ class FederationClient(FederationBase):
|
||||||
Will attempt to get the PDU from each destination in the list until
|
Will attempt to get the PDU from each destination in the list until
|
||||||
one succeeds.
|
one succeeds.
|
||||||
|
|
||||||
This will persist the PDU locally upon receipt.
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
destinations (list): Which home servers to query
|
destinations (list): Which home servers to query
|
||||||
event_id (str): event to fetch
|
event_id (str): event to fetch
|
||||||
|
@ -229,10 +224,9 @@ class FederationClient(FederationBase):
|
||||||
|
|
||||||
# TODO: Rate limit the number of times we try and get the same event.
|
# TODO: Rate limit the number of times we try and get the same event.
|
||||||
|
|
||||||
if self._get_pdu_cache:
|
ev = self._get_pdu_cache.get(event_id)
|
||||||
ev = self._get_pdu_cache.get(event_id)
|
if ev:
|
||||||
if ev:
|
defer.returnValue(ev)
|
||||||
defer.returnValue(ev)
|
|
||||||
|
|
||||||
pdu_attempts = self.pdu_destination_tried.setdefault(event_id, {})
|
pdu_attempts = self.pdu_destination_tried.setdefault(event_id, {})
|
||||||
|
|
||||||
|
@ -285,7 +279,7 @@ class FederationClient(FederationBase):
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if self._get_pdu_cache is not None and signed_pdu:
|
if signed_pdu:
|
||||||
self._get_pdu_cache[event_id] = signed_pdu
|
self._get_pdu_cache[event_id] = signed_pdu
|
||||||
|
|
||||||
defer.returnValue(signed_pdu)
|
defer.returnValue(signed_pdu)
|
||||||
|
@ -293,8 +287,7 @@ class FederationClient(FederationBase):
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
@log_function
|
@log_function
|
||||||
def get_state_for_room(self, destination, room_id, event_id):
|
def get_state_for_room(self, destination, room_id, event_id):
|
||||||
"""Requests all of the `current` state PDUs for a given room from
|
"""Requests all of the room state at a given event from a remote home server.
|
||||||
a remote home server.
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
destination (str): The remote homeserver to query for the state.
|
destination (str): The remote homeserver to query for the state.
|
||||||
|
@ -302,9 +295,10 @@ class FederationClient(FederationBase):
|
||||||
event_id (str): The id of the event we want the state at.
|
event_id (str): The id of the event we want the state at.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Deferred: Results in a list of PDUs.
|
Deferred[Tuple[List[EventBase], List[EventBase]]]:
|
||||||
|
A list of events in the state, and a list of events in the auth chain
|
||||||
|
for the given event.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# First we try and ask for just the IDs, as thats far quicker if
|
# First we try and ask for just the IDs, as thats far quicker if
|
||||||
# we have most of the state and auth_chain already.
|
# we have most of the state and auth_chain already.
|
||||||
|
|
|
@ -46,6 +46,7 @@ from synapse.replication.http.federation import (
|
||||||
from synapse.types import get_domain_from_id
|
from synapse.types import get_domain_from_id
|
||||||
from synapse.util.async_helpers import Linearizer, concurrently_execute
|
from synapse.util.async_helpers import Linearizer, concurrently_execute
|
||||||
from synapse.util.caches.response_cache import ResponseCache
|
from synapse.util.caches.response_cache import ResponseCache
|
||||||
|
from synapse.util.logcontext import nested_logging_context
|
||||||
from synapse.util.logutils import log_function
|
from synapse.util.logutils import log_function
|
||||||
|
|
||||||
# when processing incoming transactions, we try to handle multiple rooms in
|
# when processing incoming transactions, we try to handle multiple rooms in
|
||||||
|
@ -187,21 +188,22 @@ class FederationServer(FederationBase):
|
||||||
|
|
||||||
for pdu in pdus_by_room[room_id]:
|
for pdu in pdus_by_room[room_id]:
|
||||||
event_id = pdu.event_id
|
event_id = pdu.event_id
|
||||||
try:
|
with nested_logging_context(event_id):
|
||||||
yield self._handle_received_pdu(
|
try:
|
||||||
origin, pdu
|
yield self._handle_received_pdu(
|
||||||
)
|
origin, pdu
|
||||||
pdu_results[event_id] = {}
|
)
|
||||||
except FederationError as e:
|
pdu_results[event_id] = {}
|
||||||
logger.warn("Error handling PDU %s: %s", event_id, e)
|
except FederationError as e:
|
||||||
pdu_results[event_id] = {"error": str(e)}
|
logger.warn("Error handling PDU %s: %s", event_id, e)
|
||||||
except Exception as e:
|
pdu_results[event_id] = {"error": str(e)}
|
||||||
f = failure.Failure()
|
except Exception as e:
|
||||||
pdu_results[event_id] = {"error": str(e)}
|
f = failure.Failure()
|
||||||
logger.error(
|
pdu_results[event_id] = {"error": str(e)}
|
||||||
"Failed to handle PDU %s: %s",
|
logger.error(
|
||||||
event_id, f.getTraceback().rstrip(),
|
"Failed to handle PDU %s: %s",
|
||||||
)
|
event_id, f.getTraceback().rstrip(),
|
||||||
|
)
|
||||||
|
|
||||||
yield concurrently_execute(
|
yield concurrently_execute(
|
||||||
process_pdus_for_room, pdus_by_room.keys(),
|
process_pdus_for_room, pdus_by_room.keys(),
|
||||||
|
@ -618,7 +620,7 @@ class FederationServer(FederationBase):
|
||||||
)
|
)
|
||||||
|
|
||||||
yield self.handler.on_receive_pdu(
|
yield self.handler.on_receive_pdu(
|
||||||
origin, pdu, get_missing=True, sent_to_us_directly=True,
|
origin, pdu, sent_to_us_directly=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue