Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Synapse crashes with AttributeError: 'NoneType' object has no attribute 'get' on .get("msc3861", {}) if experimental_features is empty #15919

Closed
ntninja opened this issue Jul 11, 2023 · 3 comments · Fixed by #15925
Assignees
Labels
A-Config Configuration, or the documentation thereof O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Major Major functionality / product severely impaired, no satisfactory workaround. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.

Comments

@ntninja
Copy link

ntninja commented Jul 11, 2023

Description

Since upgrading from 1.85.2 to 1.87.0 just now, Synapse refuses to start. After quickly looking at the source code it turns out it like/expect when an empty experimental_features appears in the configuration:

# Configure the forbidden fruits
#
# See https://github.com/matrix-org/synapse/blob/master/synapse/config/experimental.py for current list.
experimental_features:

Commenting out that last line fixes the issue and makes Synapse start again. This happened because that key previous contained some entries but they where later removed as the relevant feature became stable. Perhaps it shouldn’t have been written this way before, but Synapse failing like this on upgrade feels like a regression.

Steps to reproduce

  • list the steps
  • that reproduce the bug
  • using hyphens as bullet points

Homeserver

matrix.ninetailed.nnja

Synapse Version

187.0

Installation Method

Docker (matrixdotorg/synapse)

Database

PostgreSQL, single server, never restored from backup or SQLite

Workers

Single process

Platform

Linux x86_64, Docker container inside VM

Configuration

No response

Relevant log output

matrix-synapse        | Starting synapse with args -m synapse.app.homeserver --config-path /data/homeserver.yaml
matrix-synapse        | Traceback (most recent call last):
matrix-synapse        |   File "<frozen runpy>", line 198, in _run_module_as_main
matrix-synapse        |   File "<frozen runpy>", line 88, in _run_code
matrix-synapse        |   File "/usr/local/lib/python3.11/site-packages/synapse/app/homeserver.py", line 398, in <module>
matrix-synapse        |     main()
matrix-synapse        |   File "/usr/local/lib/python3.11/site-packages/synapse/app/homeserver.py", line 388, in main
matrix-synapse        |     hs = setup(sys.argv[1:])
matrix-synapse        |          ^^^^^^^^^^^^^^^^^^^
matrix-synapse        |   File "/usr/local/lib/python3.11/site-packages/synapse/app/homeserver.py", line 297, in setup
matrix-synapse        |     config = HomeServerConfig.load_or_generate_config(
matrix-synapse        |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
matrix-synapse        |   File "/usr/local/lib/python3.11/site-packages/synapse/config/_base.py", line 802, in load_or_generate_config
matrix-synapse        |     obj.parse_config_dict(
matrix-synapse        |   File "/usr/local/lib/python3.11/site-packages/synapse/config/_base.py", line 823, in parse_config_dict
matrix-synapse        |     self.invoke_all(
matrix-synapse        |   File "/usr/local/lib/python3.11/site-packages/synapse/config/_base.py", line 422, in invoke_all
matrix-synapse        |     res[config_class.section] = getattr(config, func_name)(*args, **kwargs)
matrix-synapse        |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
matrix-synapse        |   File "/usr/local/lib/python3.11/site-packages/synapse/config/auth.py", line 35, in read_config
matrix-synapse        |     .get("msc3861", {})
matrix-synapse        |      ^^^
matrix-synapse        | AttributeError: 'NoneType' object has no attribute 'get'

Anything else that would be useful to know?

No response

@ntninja ntninja changed the title Synapse 1.87.0 crashes with *AttributeError: 'NoneType' object has no attribute 'get'* on *.get("msc3861", {})* Synapse crashes with *AttributeError: 'NoneType' object has no attribute 'get'* on *.get("msc3861", {})* if *experimental_features* is empty Jul 11, 2023
@ntninja
Copy link
Author

ntninja commented Jul 11, 2023

Diagnosed it now: As mentioned in the description now, it turns out it like/expect when an empty experimental_features key appears in the configuration.

@clokep clokep added S-Major Major functionality / product severely impaired, no satisfactory workaround. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. O-Uncommon Most users are unlikely to come across this or unexpected workflow labels Jul 11, 2023
@clokep
Copy link
Contributor

clokep commented Jul 11, 2023

We should check if it is a dict before that call.

@clokep
Copy link
Contributor

clokep commented Jul 12, 2023

Regression from #15582.

@MadLittleMods MadLittleMods changed the title Synapse crashes with *AttributeError: 'NoneType' object has no attribute 'get'* on *.get("msc3861", {})* if *experimental_features* is empty Synapse crashes with AttributeError: 'NoneType' object has no attribute 'get' on .get("msc3861", {}) if experimental_features is empty Jul 12, 2023
@MadLittleMods MadLittleMods added the A-Config Configuration, or the documentation thereof label Jul 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Config Configuration, or the documentation thereof O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Major Major functionality / product severely impaired, no satisfactory workaround. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants