diff options
author | Sean Quah <8349537+squahtx@users.noreply.github.com> | 2021-11-30 16:28:02 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-30 16:28:02 +0000 |
commit | 7ff22d6da41cd5ca80db95c18b409aea38e49fcd (patch) | |
tree | 99dbc2a8eb19b7c1ecf23665970d706a995e7b91 /changelog.d/11454.bugfix | |
parent | Eliminate a few `Any`s in `LruCache` type hints (#11453) (diff) | |
download | synapse-7ff22d6da41cd5ca80db95c18b409aea38e49fcd.tar.xz |
Fix `LruCache` corruption bug with a `size_callback` that can return 0 (#11454)
When all entries in an `LruCache` have a size of 0 according to the provided `size_callback`, and `drop_from_cache` is called on a cache node, the node would be unlinked from the LRU linked list but remain in the cache dictionary. An assertion would be later be tripped due to the inconsistency. Avoid unintentionally calling `__len__` and use a strict `is None` check instead when unwrapping the weak reference.
Diffstat (limited to 'changelog.d/11454.bugfix')
-rw-r--r-- | changelog.d/11454.bugfix | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/changelog.d/11454.bugfix b/changelog.d/11454.bugfix new file mode 100644 index 0000000000..096265cbc9 --- /dev/null +++ b/changelog.d/11454.bugfix @@ -0,0 +1 @@ +Fix an `LruCache` corruption bug, introduced in 1.38.0, that would cause certain requests to fail until the next Synapse restart. |