Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(pluginservers): restart all instances of a plugin
When the plugin -- which acts as a plugin server -- dies for some reason, all entities associated with it must be invalidated, not only the current. If two instances A and B of an external plugin P exist (e.g., if applied to different route objects), they receive a unique ID [1] defined by the the plugin server when the instance is started. If A and B are started sequentially and are the first instances, they get IDs 0 and 1, respectively. This ID is cached on the Kong side by the plugin server manager [2]. If plugin P dies, Kong plugin server manager will detect this condition and restart it. As it was, the code would remove whichever instance first detected the condition and leave the other in `running_instances`; once the plugin server was up, the removed instance would be restarted, in some cases with the same Id already in use by the stale instance that should have been removed from `running_instances`. Subsequent requests may then run the wrong instance of the external plugin. This change fixes the issue by ensuring that both instances A and B are removed from the `running_instances` table, [1] https://github.com/Kong/go-pdk/blob/4deec45a5bfe421a0ceebcbf7931d395250949b0/server/instance.go#L47 [2] `kong/runloop/plugin_servers/process.lua`
- Loading branch information
32528da
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bazel Build
Docker image available
kong/kong:32528da4f09d26cfc6e19ffe78025d4038c69d51
Artifacts available https://github.com/Kong/kong/actions/runs/5684843169