mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
parent
c64002e1c1
commit
80a992d7b9
1
changelog.d/8918.bugfix
Normal file
1
changelog.d/8918.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Fix occasional deadlock when handling SIGHUP.
|
@ -245,6 +245,8 @@ def start(hs: "synapse.server.HomeServer", listeners: Iterable[ListenerConfig]):
|
|||||||
# Set up the SIGHUP machinery.
|
# Set up the SIGHUP machinery.
|
||||||
if hasattr(signal, "SIGHUP"):
|
if hasattr(signal, "SIGHUP"):
|
||||||
|
|
||||||
|
reactor = hs.get_reactor()
|
||||||
|
|
||||||
@wrap_as_background_process("sighup")
|
@wrap_as_background_process("sighup")
|
||||||
def handle_sighup(*args, **kwargs):
|
def handle_sighup(*args, **kwargs):
|
||||||
# Tell systemd our state, if we're using it. This will silently fail if
|
# Tell systemd our state, if we're using it. This will silently fail if
|
||||||
@ -260,7 +262,9 @@ def start(hs: "synapse.server.HomeServer", listeners: Iterable[ListenerConfig]):
|
|||||||
# is so that we're in a sane state, e.g. flushing the logs may fail
|
# is so that we're in a sane state, e.g. flushing the logs may fail
|
||||||
# if the sighup happens in the middle of writing a log entry.
|
# if the sighup happens in the middle of writing a log entry.
|
||||||
def run_sighup(*args, **kwargs):
|
def run_sighup(*args, **kwargs):
|
||||||
hs.get_clock().call_later(0, handle_sighup, *args, **kwargs)
|
# `callFromThread` should be "signal safe" as well as thread
|
||||||
|
# safe.
|
||||||
|
reactor.callFromThread(handle_sighup, *args, **kwargs)
|
||||||
|
|
||||||
signal.signal(signal.SIGHUP, run_sighup)
|
signal.signal(signal.SIGHUP, run_sighup)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user