This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
Strip whitespace from worker types in Dockerfile-workers #14165
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist
EventStore
toEventWorkerStore
.".code blocks
.(run the linters)
Resolves #14112
This exception manifests when using two
federation_sender
s inSYNAPSE_WORKER_TYPES
, both with and when not using Complement. Trying other values with multiple workers likeevent_persister,event_persister
would work whereevent_persister, event_persister
would not. At line 448 of configure_workers_and_start.py a list is checked for values with 'count()'. It appears that the stripping of whitespace at line 423 interferes with the counting of values in the list. It won't correctly count values with extra whitespace in front. For example, the start_for_complement.sh file at line 48 exports a list of workers that ends up looking like'event_persister, event_persister, background_worker, frontend_proxy, event_creator, user_dir, media_repository, federation_inbound, federation_reader, federation_sender, synchrotron, client_reader, appservice, pusher'
Since the count in the list is looking for values with the whitespace stripped off, it fails and never actually executes function add_sharding_to_shared_config() which assembles the configuration for sharding inside of
instance_map
. This configuration is then supposed to be written to/conf/workers/shared.yaml
inside the docker image. The rest of the file is written, but the values to set up sharding do not. Unfortunately, this means that any uses of the Dockerfile-workers that utilizes sharding workers, like for instancefederation_sender
orpusher
, didn't work. I added some logging to my repo to track this down.Env worker types
is the direct string as it's passed into the docker image. Notice the extra leading whitespace pulled in from a direct copy of the values in start_for_complement.sh:Before:
After:
Worker Type total count is the value that's important. If it doesn't get above 1, then add_sharding_to_shared_config() doesn't execute. After fixing this on my own homeserver, the
event_persister
workers exploded into activity. I thought it was just a really efficient process.Signed-off-by: Jason Little realtyem@gmail.com