Skip to content

Commit

Permalink
fix(plugins): change log level from error to info when restarting ext…
Browse files Browse the repository at this point in the history
…ernal plugin instance (#8652)

When the external plugin instances (go, python, ...) loses the instances_id in a event handler, the instance is restarted to complete the plugin call but a weird error appear:
```
2021/08/20 10:23:59 [**error**] 30#0: *51336 [kong] mp_rpc.lua:308 [jwe] no plugin instance 0, client: 10.240.0.178, server: kong, request: "POST /example HTTP/1.1", host: "example.es"
```
We change the log level to info as this is not a real problem as the plugin is restarted lately in code (considering the message string as well)

Co-authored-by: Xumin <100666470+Suika-Kong@users.noreply.github.com>
  • Loading branch information
ealogar and StarlightIbuki authored May 25, 2022
1 parent 4d29046 commit 0d559f1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions kong/runloop/plugin_servers/mp_rpc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,12 @@ function Rpc:handle_event(plugin_name, conf, phase)
local _, err = bridge_loop(self, instance_id, phase)

if err then
kong.log.err(err)

if string.match(err:lower(), "no plugin instance") then
kong.log.warn(err)
self.reset_instance(plugin_name, conf)
return self:handle_event(plugin_name, conf, phase)
end
kong.log.err(err)
end
end

Expand Down
8 changes: 4 additions & 4 deletions kong/runloop/plugin_servers/pb_rpc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -394,13 +394,13 @@ function Rpc:handle_event(plugin_name, conf, phase)
event_name = phase,
}, true)
if not res or res == "" then
kong.log.err(err)
if string.match(err:lower(), "no plugin instance")
or string.match(err:lower(), "closed") then

if string.match(err:lower(), "no plugin instance")
or string.match(err:lower(), "closed") then
kong.log.warn(err)
self.reset_instance(plugin_name, conf)
return self:handle_event(plugin_name, conf, phase)
end
kong.log.err(err)
end
end

Expand Down

0 comments on commit 0d559f1

Please sign in to comment.