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

Synapse does not exit on a config failure #4543

Closed
richvdh opened this issue Feb 1, 2019 · 2 comments
Closed

Synapse does not exit on a config failure #4543

richvdh opened this issue Feb 1, 2019 · 2 comments
Assignees

Comments

@richvdh
Copy link
Member

richvdh commented Feb 1, 2019

If there is an error during startup (like not being able to load the ssl certs or bind to the http port), Synapse prints out an error but does not exit

@richvdh
Copy link
Member Author

richvdh commented Feb 1, 2019

For example, if the cert doesn't exist:

2019-02-01 11:12:19,426 - twisted - 245 - ERROR - - Traceback (most recent call last):
2019-02-01 11:12:19,428 - twisted - 245 - ERROR - -   File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/config/_base.py", line 111, in check_file
2019-02-01 11:12:19,429 - twisted - 245 - ERROR - -     os.stat(file_path)
2019-02-01 11:12:19,429 - twisted - 245 - ERROR - - FileNotFoundError: [Errno 2] No such file or directory: '/etc/matrix-synapse/homeserver.tls.crt'
2019-02-01 11:12:19,433 - twisted - 245 - ERROR - - 
2019-02-01 11:12:19,433 - twisted - 245 - ERROR - - During handling of the above exception, another exception occurred:
2019-02-01 11:12:19,433 - twisted - 245 - ERROR - - 
2019-02-01 11:12:19,434 - twisted - 245 - ERROR - - Traceback (most recent call last):
2019-02-01 11:12:19,434 - twisted - 245 - ERROR - -   File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/app/homeserver.py", line 430, in start
2019-02-01 11:12:19,434 - twisted - 245 - ERROR - -     hs.config.read_certificate_from_disk()
2019-02-01 11:12:19,434 - twisted - 245 - ERROR - -   File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/config/tls.py", line 99, in read_certificate_from_disk
2019-02-01 11:12:19,435 - twisted - 245 - ERROR - -     self.tls_certificate = self.read_tls_certificate(self.tls_certificate_file)
2019-02-01 11:12:19,437 - twisted - 245 - ERROR - -   File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/config/tls.py", line 240, in read_tls_certificate
2019-02-01 11:12:19,438 - twisted - 245 - ERROR - -     cert_pem = self.read_file(cert_path, "tls_certificate")
2019-02-01 11:12:19,440 - twisted - 245 - ERROR - -   File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/config/_base.py", line 133, in read_file
2019-02-01 11:12:19,442 - twisted - 245 - ERROR - -     cls.check_file(file_path, config_name)
2019-02-01 11:12:19,444 - twisted - 245 - ERROR - -   File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/config/_base.py", line 115, in check_file
2019-02-01 11:12:19,444 - twisted - 245 - ERROR - -     % (file_path, config_name, e.strerror)
2019-02-01 11:12:19,445 - twisted - 245 - ERROR - - synapse.config._base.ConfigError: Error accessing file '/etc/matrix-synapse/homeserver.tls.crt' (config for tls_certificate): No such file or directory
2019-02-01 11:12:19,475 - twisted - 245 - CRITICAL - - Unhandled error in Deferred:
2019-02-01 11:12:19,475 - twisted - 245 - CRITICAL - - 
Traceback (most recent call last):
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/config/_base.py", line 111, in check_file
    os.stat(file_path)
FileNotFoundError: [Errno 2] No such file or directory: '/etc/matrix-synapse/homeserver.tls.crt'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/app/homeserver.py", line 430, in start
    hs.config.read_certificate_from_disk()
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/config/tls.py", line 99, in read_certificate_from_disk
    self.tls_certificate = self.read_tls_certificate(self.tls_certificate_file)
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/config/tls.py", line 240, in read_tls_certificate
    cert_pem = self.read_file(cert_path, "tls_certificate")
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/config/_base.py", line 133, in read_file
    cls.check_file(file_path, config_name)
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/config/_base.py", line 115, in check_file
    % (file_path, config_name, e.strerror)
synapse.config._base.ConfigError: Error accessing file '/etc/matrix-synapse/homeserver.tls.crt' (config for tls_certificate): No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
    result = g.send(result)
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/app/homeserver.py", line 450, in start
    sys.exit(1)
SystemExit: 1

@richvdh
Copy link
Member Author

richvdh commented Feb 14, 2019

This was fixed in #4567.

Synapse does now exit, but the experience is still not entirely satisfactory (#4640, #4641).

@richvdh richvdh closed this as completed Feb 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants