Preflight check has a race condition where duplicate settings can be inserted and stop app from starting

Description

If a weird cache race condition is found, where ContentBox thinks there are no settings in the DB,, the Preflight check would insert 135 duplicate settings, causing every ORM findWhere to return more than 1 record for a setting name, stopping ColdBox from Initiliazing, resulting in many strange and not so wonderful errors.

We need to add a unique setting to the ORM model, and add the CBValidation for more helpful validation of this model.

https://github.com/Ortus-Solutions/ContentBox/pull/430

Activity

Show:
Jon Clausen
April 17, 2019, 2:26 PM
Edited

This issue is still not resolved, because the preflight check does not use validation before it saves. This is probably something that should be enforced at the database level, as well, because this issue causes the entire application to fatal error out. The only way to resolve the issue is by modifying the database directly, as it cannot be fixed from within the application.

I'm pushing up a PR which adds a `useCache` flag ( default `true` ) to the `getAllSettings()` method in `SettingsService`. The preflight check should probably not be leveraging the cache.

https://github.com/Ortus-Solutions/ContentBox/pull/434

Fixed
Your pinned fields
Click on the next to a field label to start pinning.

Assignee

Gavin Pickin

Reporter

Gavin Pickin