This repository was archived by the owner on Apr 13, 2025. It is now read-only.
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
Description
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
- Start nodecg normally and login, leave the browser tab open
- Restart nodecg
- As the browser reconnects and nodecg-io starts loading the config stop it
- Start it back up and see that almost all configs are deleted (depends on timing)