Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

PersistenceManager can corrupt config due to a race condition #217

Closed
hlxid opened this issue Mar 12, 2021 · 0 comments · Fixed by #219
Closed

PersistenceManager can corrupt config due to a race condition #217

hlxid opened this issue Mar 12, 2021 · 0 comments · Fixed by #219
Assignees
Labels
bug Something isn't working framework Requires changes to the framework urgent When something is more than just 'it's an open source project' important
Milestone

Comments

@hlxid
Copy link
Member

hlxid commented Mar 12, 2021

Description

The Persitence Manager saves once something has been changed in any of the other managers. When loading it will do the same (which creates unneccesary writes but that's another problem). But when you don't wait long enough after it has started loading and adds all entries back and stop nodecg this will result in a corrupted config because some of the config haven't been set again and the PersitenceManager will have written the current state without this config.
On the next start you will see error messages because the config isn't just a empty object but undefined:

info: [nodecg-io-core] Couldn't load config of instance "tw-chat" from saved configuration: Config invalid: data should be object.

How to reproduce

  1. Start nodecg normally and login, leave the browser tab open
  2. Restart nodecg
  3. As the browser reconnects and nodecg-io starts loading the config stop it
  4. Start it back up and see that almost all configs are deleted (depends on timing)
@hlxid hlxid added bug Something isn't working urgent When something is more than just 'it's an open source project' important framework Requires changes to the framework labels Mar 12, 2021
@hlxid hlxid added this to the v0.1.0 milestone Mar 12, 2021
@hlxid hlxid self-assigned this Mar 12, 2021
hlxid added a commit that referenced this issue Mar 12, 2021
Lowers effect #217 a lot. Will be re-added once that is fixed
@hlxid hlxid changed the title PersistanceManager can corrupt config due to a race condition PersistenceManager can corrupt config due to a race condition Mar 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working framework Requires changes to the framework urgent When something is more than just 'it's an open source project' important
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant