Add warning about known problems when configuring use_frozen_dicts#19711
Add warning about known problems when configuring use_frozen_dicts#19711MadLittleMods merged 5 commits intodevelopfrom
use_frozen_dicts#19711Conversation
| > ⚠️ **Warning** – This option is known to introduce a new class of [comparison | ||
| bugs](https://github.com/element-hq/synapse/issues/18117) in Synapse. |
There was a problem hiding this comment.
This is the same warning format as other places (we're not that consistent though)
synapse/schema/synapse-config.schema.yaml
Lines 3084 to 3086 in a9361c4
synapse/schema/synapse-config.schema.yaml
Lines 3682 to 3686 in a9361c4
| *(boolean)* Determines whether we should freeze the internal dict object in `FrozenEvent`. Freezing prevents bugs where we accidentally share e.g. signature dicts. However, freezing a dict is expensive. Defaults to `false`. | ||
| *(boolean)* Determines whether we should freeze the internal dict object in `FrozenEvent`. Freezing prevents bugs where we accidentally share e.g. signature dicts. However, freezing a dict is expensive. | ||
|
|
||
| > ⚠️ **Warning** – This option is known to introduce a new class of [comparison bugs](https://github.com/element-hq/synapse/issues/18117) in Synapse. |
There was a problem hiding this comment.
If this implementation is buggy, wouldn't it just be better to remove it, or at least disabled it unconditionally until it works? Seems ill advised to me to leave options in that actively break software
There was a problem hiding this comment.
Agreed 👍 PR description suggests a follow-up to remove.
I'd rather document this now than be held up by a refactor that may never happen or is a more controversial change in terms of getting it across the line. It also makes the follow-up PR more clear as the reasoning is contained within.
|
Thanks for the review @frebib and @erikjohnston 🐬 |
Add warning about known problems when configuring
use_frozen_dictsAs a follow-up, we should consider removing this config option altogether. It's "expensive" and claims to "prevent bugs" but actually introduces a whole new class of bugs. It could be re-introduced with a more holistic solution to the typing. Or a completely new approach (safe mode that blows up when someone mutates the event content, always make deep clones when handing out references, etc)
Dev notes
The
use_frozen_dictconfig option was there since inception but was only recently documented for completeness sake.Pull Request Checklist
EventStoretoEventWorkerStore.".code blocks.