Synapse is unable to cleanly shutdown homeserver after failing to setup. Like when it fails to connect to the database for whatever reason.
Discovered while writing some Complement tests for Synapse Pro for small hosts: https://github.com/element-hq/synapse-small-hosts/pull/204
Sister issue to #19189
Reproduction
# XXX: Use some homeserver config that has an invalid database path for SQLite3
homeserver_config = HomeServerConfig.load_config(
"Synapse Homeserver", argv_options
)
hs = create_homeserver(homeserver_config)
hs_ref = weakref.ref(hs)
try:
# We expect this to explode at this point because it's unable to connect to the database
setup(hs)
except Exception as exc:
# Cleanup on failure
await hs.shutdown()
# Cleanup the internal reference in our test case
del hs
# Force garbage collection.
gc.collect()
hs_after_shutdown = hs_ref()
if hs_after_shutdown is not None:
self.fail("HomeServer reference should not be valid at this point ")
Synapse is unable to cleanly
shutdownhomeserver after failing tosetup. Like when it fails to connect to the database for whatever reason.Discovered while writing some Complement tests for Synapse Pro for small hosts: https://github.com/element-hq/synapse-small-hosts/pull/204
Sister issue to #19189
Reproduction