Merge branch 'develop' of github.com:matrix-org/synapse into matrix-org-hotfixes
commit
18b1a92162
|
@ -0,0 +1 @@
|
||||||
|
Update example_log_config.yaml.
|
|
@ -0,0 +1 @@
|
||||||
|
Document the `generate` option for the docker image.
|
|
@ -0,0 +1 @@
|
||||||
|
Fix check-newsfragment for debian-only changes.
|
|
@ -0,0 +1 @@
|
||||||
|
Add some debug logging for device list updates to help with #4828.
|
|
@ -0,0 +1 @@
|
||||||
|
Fix potential race in handling missing updates in device list updates.
|
|
@ -19,6 +19,7 @@ handlers:
|
||||||
# example output to console
|
# example output to console
|
||||||
console:
|
console:
|
||||||
class: logging.StreamHandler
|
class: logging.StreamHandler
|
||||||
|
formatter: fmt
|
||||||
filters: [context]
|
filters: [context]
|
||||||
|
|
||||||
# example output to file - to enable, edit 'root' config below.
|
# example output to file - to enable, edit 'root' config below.
|
||||||
|
@ -29,7 +30,7 @@ handlers:
|
||||||
maxBytes: 100000000
|
maxBytes: 100000000
|
||||||
backupCount: 3
|
backupCount: 3
|
||||||
filters: [context]
|
filters: [context]
|
||||||
|
encoding: utf8
|
||||||
|
|
||||||
root:
|
root:
|
||||||
level: INFO
|
level: INFO
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
matrix-synapse-py3 (0.99.3) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
|
* Fix warning during preconfiguration. (Fixes: #4819)
|
||||||
|
|
||||||
|
-- Richard van der Hoff <richard@matrix.org> Thu, 07 Mar 2019 07:17:00 +0000
|
||||||
|
|
||||||
matrix-synapse-py3 (0.99.2) stable; urgency=medium
|
matrix-synapse-py3 (0.99.2) stable; urgency=medium
|
||||||
|
|
||||||
* Fix overwriting of config settings on upgrade.
|
* Fix overwriting of config settings on upgrade.
|
||||||
|
|
|
@ -5,7 +5,11 @@ set -e
|
||||||
. /usr/share/debconf/confmodule
|
. /usr/share/debconf/confmodule
|
||||||
|
|
||||||
# try to update the debconf db according to whatever is in the config files
|
# try to update the debconf db according to whatever is in the config files
|
||||||
/opt/venvs/matrix-synapse/lib/manage_debconf.pl read || true
|
#
|
||||||
|
# note that we may get run during preconfiguration, in which case the script
|
||||||
|
# will not yet be installed.
|
||||||
|
[ -x /opt/venvs/matrix-synapse/lib/manage_debconf.pl ] && \
|
||||||
|
/opt/venvs/matrix-synapse/lib/manage_debconf.pl read
|
||||||
|
|
||||||
db_input high matrix-synapse/server-name || true
|
db_input high matrix-synapse/server-name || true
|
||||||
db_input high matrix-synapse/report-stats || true
|
db_input high matrix-synapse/report-stats || true
|
||||||
|
|
|
@ -28,7 +28,7 @@ with your postgres database.
|
||||||
docker run \
|
docker run \
|
||||||
-d \
|
-d \
|
||||||
--name synapse \
|
--name synapse \
|
||||||
-v ${DATA_PATH}:/data \
|
--mount type=volume,src=synapse-data,dst=/data \
|
||||||
-e SYNAPSE_SERVER_NAME=my.matrix.host \
|
-e SYNAPSE_SERVER_NAME=my.matrix.host \
|
||||||
-e SYNAPSE_REPORT_STATS=yes \
|
-e SYNAPSE_REPORT_STATS=yes \
|
||||||
matrixdotorg/synapse:latest
|
matrixdotorg/synapse:latest
|
||||||
|
@ -87,10 +87,15 @@ Global settings:
|
||||||
* ``SYNAPSE_CONFIG_PATH``, path to a custom config file
|
* ``SYNAPSE_CONFIG_PATH``, path to a custom config file
|
||||||
|
|
||||||
If ``SYNAPSE_CONFIG_PATH`` is set, you should generate a configuration file
|
If ``SYNAPSE_CONFIG_PATH`` is set, you should generate a configuration file
|
||||||
then customize it manually. No other environment variable is required.
|
then customize it manually: see [Generating a config
|
||||||
|
file](#generating-a-config-file).
|
||||||
|
|
||||||
Otherwise, a dynamic configuration file will be used. The following environment
|
Otherwise, a dynamic configuration file will be used.
|
||||||
variables are available for configuration:
|
|
||||||
|
### Environment variables used to build a dynamic configuration file
|
||||||
|
|
||||||
|
The following environment variables are used to build the configuration file
|
||||||
|
when ``SYNAPSE_CONFIG_PATH`` is not set.
|
||||||
|
|
||||||
* ``SYNAPSE_SERVER_NAME`` (mandatory), the server public hostname.
|
* ``SYNAPSE_SERVER_NAME`` (mandatory), the server public hostname.
|
||||||
* ``SYNAPSE_REPORT_STATS``, (mandatory, ``yes`` or ``no``), enable anonymous
|
* ``SYNAPSE_REPORT_STATS``, (mandatory, ``yes`` or ``no``), enable anonymous
|
||||||
|
@ -143,3 +148,31 @@ Mail server specific values (will not send emails if not set):
|
||||||
any.
|
any.
|
||||||
* ``SYNAPSE_SMTP_PASSWORD``, password for authenticating against the mail
|
* ``SYNAPSE_SMTP_PASSWORD``, password for authenticating against the mail
|
||||||
server if any.
|
server if any.
|
||||||
|
|
||||||
|
### Generating a config file
|
||||||
|
|
||||||
|
It is possible to generate a basic configuration file for use with
|
||||||
|
`SYNAPSE_CONFIG_PATH` using the `generate` commandline option. You will need to
|
||||||
|
specify values for `SYNAPSE_CONFIG_PATH`, `SYNAPSE_SERVER_NAME` and
|
||||||
|
`SYNAPSE_REPORT_STATS`, and mount a docker volume to store the data on. For
|
||||||
|
example:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run -it --rm
|
||||||
|
--mount type=volume,src=synapse-data,dst=/data \
|
||||||
|
-e SYNAPSE_CONFIG_PATH=/data/homeserver.yaml \
|
||||||
|
-e SYNAPSE_SERVER_NAME=my.matrix.host \
|
||||||
|
-e SYNAPSE_REPORT_STATS=yes \
|
||||||
|
matrixdotorg/synapse:latest generate
|
||||||
|
```
|
||||||
|
|
||||||
|
This will generate a `homeserver.yaml` in (typically)
|
||||||
|
`/var/lib/docker/volumes/synapse-data/_data`, which you can then customise and
|
||||||
|
use with:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run -d --name synapse \
|
||||||
|
--mount type=volume,src=synapse-data,dst=/data \
|
||||||
|
-e SYNAPSE_CONFIG_PATH=/data/homeserver.yaml \
|
||||||
|
matrixdotorg/synapse:latest
|
||||||
|
```
|
||||||
|
|
|
@ -7,14 +7,12 @@ set -e
|
||||||
|
|
||||||
# make sure that origin/develop is up to date
|
# make sure that origin/develop is up to date
|
||||||
git remote set-branches --add origin develop
|
git remote set-branches --add origin develop
|
||||||
git fetch --depth=1 origin develop
|
git fetch origin develop
|
||||||
|
|
||||||
UPSTREAM=origin/develop
|
|
||||||
|
|
||||||
# if there are changes in the debian directory, check that the debian changelog
|
# if there are changes in the debian directory, check that the debian changelog
|
||||||
# has been updated
|
# has been updated
|
||||||
if ! git diff --quiet $UPSTREAM... -- debian; then
|
if ! git diff --quiet FETCH_HEAD... -- debian; then
|
||||||
if git diff --quiet $UPSTREAM... -- debian/changelog; then
|
if git diff --quiet FETCH_HEAD... -- debian/changelog; then
|
||||||
echo "Updates to debian directory, but no update to the changelog." >&2
|
echo "Updates to debian directory, but no update to the changelog." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -22,7 +20,7 @@ fi
|
||||||
|
|
||||||
# if there are changes *outside* the debian directory, check that the
|
# if there are changes *outside* the debian directory, check that the
|
||||||
# newsfragments have been updated.
|
# newsfragments have been updated.
|
||||||
if git diff --name-only $UPSTREAM... | grep -qv '^develop/'; then
|
if git diff --name-only FETCH_HEAD... | grep -qv '^debian/'; then
|
||||||
tox -e check-newsfragment
|
tox -e check-newsfragment
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -31,7 +29,7 @@ echo "--------------------------"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# check that any new newsfiles on this branch end with a full stop.
|
# check that any new newsfiles on this branch end with a full stop.
|
||||||
for f in `git diff --name-only $UPSTREAM... -- changelog.d`; do
|
for f in `git diff --name-only FETCH_HEAD... -- changelog.d`; do
|
||||||
lastchar=`tr -d '\n' < $f | tail -c 1`
|
lastchar=`tr -d '\n' < $f | tail -c 1`
|
||||||
if [ $lastchar != '.' ]; then
|
if [ $lastchar != '.' ]; then
|
||||||
echo -e "\e[31mERROR: newsfragment $f does not end with a '.'\e[39m" >&2
|
echo -e "\e[31mERROR: newsfragment $f does not end with a '.'\e[39m" >&2
|
||||||
|
|
|
@ -402,6 +402,12 @@ class DeviceHandler(DeviceWorkerHandler):
|
||||||
user_id, device_ids, list(hosts)
|
user_id, device_ids, list(hosts)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
for device_id in device_ids:
|
||||||
|
logger.debug(
|
||||||
|
"Notifying about update %r/%r, ID: %r", user_id, device_id,
|
||||||
|
position,
|
||||||
|
)
|
||||||
|
|
||||||
room_ids = yield self.store.get_rooms_for_user(user_id)
|
room_ids = yield self.store.get_rooms_for_user(user_id)
|
||||||
|
|
||||||
yield self.notifier.on_new_event(
|
yield self.notifier.on_new_event(
|
||||||
|
@ -409,7 +415,7 @@ class DeviceHandler(DeviceWorkerHandler):
|
||||||
)
|
)
|
||||||
|
|
||||||
if hosts:
|
if hosts:
|
||||||
logger.info("Sending device list update notif to: %r", hosts)
|
logger.info("Sending device list update notif for %r to: %r", user_id, hosts)
|
||||||
for host in hosts:
|
for host in hosts:
|
||||||
self.federation_sender.send_device_messages(host)
|
self.federation_sender.send_device_messages(host)
|
||||||
|
|
||||||
|
@ -479,15 +485,26 @@ class DeviceListEduUpdater(object):
|
||||||
|
|
||||||
if get_domain_from_id(user_id) != origin:
|
if get_domain_from_id(user_id) != origin:
|
||||||
# TODO: Raise?
|
# TODO: Raise?
|
||||||
logger.warning("Got device list update edu for %r from %r", user_id, origin)
|
logger.warning(
|
||||||
|
"Got device list update edu for %r/%r from %r",
|
||||||
|
user_id, device_id, origin,
|
||||||
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
room_ids = yield self.store.get_rooms_for_user(user_id)
|
room_ids = yield self.store.get_rooms_for_user(user_id)
|
||||||
if not room_ids:
|
if not room_ids:
|
||||||
# We don't share any rooms with this user. Ignore update, as we
|
# We don't share any rooms with this user. Ignore update, as we
|
||||||
# probably won't get any further updates.
|
# probably won't get any further updates.
|
||||||
|
logger.warning(
|
||||||
|
"Got device list update edu for %r/%r, but don't share a room",
|
||||||
|
user_id, device_id,
|
||||||
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
logger.debug(
|
||||||
|
"Received device list update for %r/%r", user_id, device_id,
|
||||||
|
)
|
||||||
|
|
||||||
self._pending_updates.setdefault(user_id, []).append(
|
self._pending_updates.setdefault(user_id, []).append(
|
||||||
(device_id, stream_id, prev_ids, edu_content)
|
(device_id, stream_id, prev_ids, edu_content)
|
||||||
)
|
)
|
||||||
|
@ -505,10 +522,18 @@ class DeviceListEduUpdater(object):
|
||||||
# This can happen since we batch updates
|
# This can happen since we batch updates
|
||||||
return
|
return
|
||||||
|
|
||||||
|
for device_id, stream_id, prev_ids, content in pending_updates:
|
||||||
|
logger.debug(
|
||||||
|
"Handling update %r/%r, ID: %r, prev: %r ",
|
||||||
|
user_id, device_id, stream_id, prev_ids,
|
||||||
|
)
|
||||||
|
|
||||||
# Given a list of updates we check if we need to resync. This
|
# Given a list of updates we check if we need to resync. This
|
||||||
# happens if we've missed updates.
|
# happens if we've missed updates.
|
||||||
resync = yield self._need_to_do_resync(user_id, pending_updates)
|
resync = yield self._need_to_do_resync(user_id, pending_updates)
|
||||||
|
|
||||||
|
logger.debug("Need to re-sync devices for %r? %r", user_id, resync)
|
||||||
|
|
||||||
if resync:
|
if resync:
|
||||||
# Fetch all devices for the user.
|
# Fetch all devices for the user.
|
||||||
origin = get_domain_from_id(user_id)
|
origin = get_domain_from_id(user_id)
|
||||||
|
@ -561,11 +586,21 @@ class DeviceListEduUpdater(object):
|
||||||
)
|
)
|
||||||
devices = []
|
devices = []
|
||||||
|
|
||||||
|
for device in devices:
|
||||||
|
logger.debug(
|
||||||
|
"Handling resync update %r/%r, ID: %r",
|
||||||
|
user_id, device["device_id"], stream_id,
|
||||||
|
)
|
||||||
|
|
||||||
yield self.store.update_remote_device_list_cache(
|
yield self.store.update_remote_device_list_cache(
|
||||||
user_id, devices, stream_id,
|
user_id, devices, stream_id,
|
||||||
)
|
)
|
||||||
device_ids = [device["device_id"] for device in devices]
|
device_ids = [device["device_id"] for device in devices]
|
||||||
yield self.device_handler.notify_device_update(user_id, device_ids)
|
yield self.device_handler.notify_device_update(user_id, device_ids)
|
||||||
|
|
||||||
|
# We clobber the seen updates since we've re-synced from a given
|
||||||
|
# point.
|
||||||
|
self._seen_updates[user_id] = set([stream_id])
|
||||||
else:
|
else:
|
||||||
# Simply update the single device, since we know that is the only
|
# Simply update the single device, since we know that is the only
|
||||||
# change (because of the single prev_id matching the current cache)
|
# change (because of the single prev_id matching the current cache)
|
||||||
|
@ -578,9 +613,9 @@ class DeviceListEduUpdater(object):
|
||||||
user_id, [device_id for device_id, _, _, _ in pending_updates]
|
user_id, [device_id for device_id, _, _, _ in pending_updates]
|
||||||
)
|
)
|
||||||
|
|
||||||
self._seen_updates.setdefault(user_id, set()).update(
|
self._seen_updates.setdefault(user_id, set()).update(
|
||||||
stream_id for _, stream_id, _, _ in pending_updates
|
stream_id for _, stream_id, _, _ in pending_updates
|
||||||
)
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _need_to_do_resync(self, user_id, updates):
|
def _need_to_do_resync(self, user_id, updates):
|
||||||
|
@ -593,6 +628,11 @@ class DeviceListEduUpdater(object):
|
||||||
user_id
|
user_id
|
||||||
)
|
)
|
||||||
|
|
||||||
|
logger.debug(
|
||||||
|
"Current extremity for %r: %r",
|
||||||
|
user_id, extremity,
|
||||||
|
)
|
||||||
|
|
||||||
stream_id_in_updates = set() # stream_ids in updates list
|
stream_id_in_updates = set() # stream_ids in updates list
|
||||||
for _, stream_id, prev_ids, _ in updates:
|
for _, stream_id, prev_ids, _ in updates:
|
||||||
if not prev_ids:
|
if not prev_ids:
|
||||||
|
|
Loading…
Reference in New Issue