Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
plugins: Fix race between manager and plugin startup
This change fixes a race condition in the manager that was caused by registering the storage trigger _after_ the plugins had been started. The problem was that if the bundle plugin was able to download and activate before the trigger registration in the manager went through, the store and the manager would be out-of-sync after startup. The bundle would activate successfully but the plugin manager would not see the change. This meant that the server health check, status plugin, etc. would report successful activation and clients using either of those APIs for synchronization could start querying. If they executed a query within this window, virtual docs would not be visible because the plugin manager would not yet have a compiler to return to the server. Similarly, if clients queried the v1/policies API they would see the raw policy contents but no AST (since the latter is retrieved from the compiler.) To remove the race condition the plugin manager simply registers the trigger before starting any of the plugins. This ensures that it sees all changes made by any of the plugins. Fixes open-policy-agent#2343 Signed-off-by: Torin Sandall <torinsandall@gmail.com>
- Loading branch information