element-hq / element-hq/synapse
Logging loop after SIGHUP when a `StreamHandler` is configured
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
This issue has been migrated from [#6550](https://github.com/matrix-org/synapse/issues/6550).
---
If you use the default logging config, which has a `StreamHandler` pointing at sys.stderr, and do not set `--no-redirect-stdio`, then when you send synapse a SIGHUP, it will stack overflow and abort.
The problem appears to be that when you SIGHUP it, the streamhandler gets repointed at the redirected stderr, which goes back into a logger: so as soon as anything is logged, we get an infinite loop.
Contributor guide
Research direction
Reproduce with the default logging config and a SIGHUP while leaving --no-redirect-stdio unset; trace how the StreamHandler pointing at sys.stderr is repointed to redirected stderr. Confirm the issue is resolved when SIGHUP no longer causes recursive logging, a stack overflow, or an abort.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, observability-sre
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100