mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Stop the parent process flushing the logs on exit (#8012)
This solves the problem that the first few lines are logged twice on matrix.org. Hopefully the comments explain it.
This commit is contained in:
parent
8b786db323
commit
0a86850ba3
1
changelog.d/8011.bugfix
Normal file
1
changelog.d/8011.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Fix a long-standing bug which caused two copies of some log lines to be written when synctl was used along with a MemoryHandler logger.
|
@ -1 +0,0 @@
|
|||||||
Replace daemonize library with a local implementation.
|
|
1
changelog.d/8012.bugfix
Normal file
1
changelog.d/8012.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Fix a long-standing bug which caused two copies of some log lines to be written when synctl was used along with a MemoryHandler logger.
|
@ -60,8 +60,14 @@ def daemonize_process(pid_file: str, logger: logging.Logger, chdir: str = "/") -
|
|||||||
process_id = os.fork()
|
process_id = os.fork()
|
||||||
|
|
||||||
if process_id != 0:
|
if process_id != 0:
|
||||||
# parent process
|
# parent process: exit.
|
||||||
sys.exit(0)
|
|
||||||
|
# we use os._exit to avoid running the atexit handlers. In particular, that
|
||||||
|
# means we don't flush the logs. This is important because if we are using
|
||||||
|
# a MemoryHandler, we could have logs buffered which are now buffered in both
|
||||||
|
# the main and the child process, so if we let the main process flush the logs,
|
||||||
|
# we'll get two copies.
|
||||||
|
os._exit(0)
|
||||||
|
|
||||||
# This is the child process. Continue.
|
# This is the child process. Continue.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user