This issue has been migrated from #10342.
logcontexts are super confusing, and easy to mess up.
We should experiment with replacing the thread-local variable we currently use with a contextvar, which Twisted has first-class support for (twisted/twisted#1192), which could potentially save everyone who ever touches Synapse code a great deal of pain.