Files
synapse/tests/http
Erik Johnston 818f2b25bb Fix error log when writing a large response. (#20246)
We sometimes see a lot of `ERROR` logs like the following:

```
Closing scope Scope<... master.write_bytes_to_request> which is not the currently-active one None
```

This error is generated by `opentracing.Scope` checking that it is the
"active" one. Synapse tracks "active" spans via logcontexts, so this
indirectly asserts that the scope is closed in the context it was opened
in. However, the producer methods are often called from the reactor and
therefore withing the sentinel logcontext, which produces the error
above.

This specifically happens when the producer tries to write large
responses but gets paused, and then later resumes.

The fix is to simply use `Span` directly, rather than scopes. `Span`
does not perform the checks.

I noticed this when deploying #19979, though it is unrelated.
2026-09-23 09:46:50 +01:00
..
2023-11-21 15:29:58 -05:00