summary refs log tree commit diff
path: root/synapse/util/metrics.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-05-02 11:46:23 +0100
committerRichard van der Hoff <richard@matrix.org>2018-05-02 11:58:00 +0100
commitf22e7cda2c72d461acba664cb083e8c4e3c7572a (patch)
tree8758ca0bee95075e2aa386cecf0fdb34f7fbf161 /synapse/util/metrics.py
parentMerge branch 'release-v0.28.1' into develop (diff)
downloadsynapse-f22e7cda2c72d461acba664cb083e8c4e3c7572a.tar.xz
Fix a class of logcontext leaks
So, it turns out that if you have a first `Deferred` `D1`, you can add a
callback which returns another `Deferred` `D2`, and `D2` must then complete
before any further callbacks on `D1` will execute (and later callbacks on `D1`
get the *result* of `D2` rather than `D2` itself).

So, `D1` might have `called=True` (as in, it has started running its
callbacks), but any new callbacks added to `D1` won't get run until `D2`
completes - so if you `yield D1` in an `inlineCallbacks` function, your `yield`
will 'block'.

In conclusion: some of our assumptions in `logcontext` were invalid. We need to
make sure that we don't optimise out the logcontext juggling when this
situation happens. Fortunately, it is easy to detect by checking `D1.paused`.
Diffstat (limited to 'synapse/util/metrics.py')
0 files changed, 0 insertions, 0 deletions