[plugins] Log warnings from core in dev mode when setup
contracts are called after start
.
#124039
Labels
Feature:Plugins
impact:medium
Addressing this issue will have a medium level of impact on the quality/strength of our product.
loe:small
Small Level of Effort
Team:Core
Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
There are many places in Kibana where we find plugins abusing lifecycle methods by doing things like holding references to dependencies from the
setup
contract, and then using that dependency later during thestart
lifecycle.While some of these abuses are relatively harmless, it can create much more serious problems in the case of things like registries: If a plugin holds a reference to a registry from
setup
, and then registers an item to it duringstart
, plugins can no longer be assured that the registry is fully populated by the time we reachstart
... thus breaking the guarantees lifecycles were designed to provide.There are some places in core where we have put safeguards in place to prevent such behavior:
kibana/src/core/server/saved_objects/saved_objects_service.ts
Lines 374 to 377 in ca05637
However, the only way to have this be completely bulletproof would be for every plugin exposing public registries to apply similar safeguards. A much simpler way to start would be by simply logging a warning while in dev mode if we detect a plugin calling any
setup
contracts afterstart
has begun.Tasks
setup
API has been called instart
orstop
, and we are in dev mode, log a warningstart
API has been called instop
, and we are in dev mode, log a warningcc @stacey-gammon
The text was updated successfully, but these errors were encountered: