Skip to content

Commit

Permalink
fix(balancer) protect against nil request context data (#6416)
Browse files Browse the repository at this point in the history
Fix errors like these:

```
2020/10/01 14:09:57 [debug] 5632#0: *95 [lua] base_plugin.lua:26: access(): executing plugin "canary": access
2020/10/01 14:09:57 [error] 5632#0: *95 [kong] init.lua:266 [canary] /kong/kong/runloop/balancer.lua:1097: attempt to index local 'ctx' (a nil value), client: 127.0.0.1, server: kong, request: "GET / HTTP/1.1", host: "canary5.com"
2020/10/01 14:09:57 [debug] 5632#0: *95 [lua] base_plugin.lua:26: access(): executing plugin "canary": access
2020/10/01 14:09:57 [error] 5632#0: *95 [kong] init.lua:266 [canary] /kong/kong/runloop/balancer.lua:1097: attempt to index local 'ctx' (a nil value), client: 127.0.0.1, server: kong, request: "GET / HTTP/1.1", host: "canary5.com"'
```
  • Loading branch information
Murillo Paula authored Oct 7, 2020
1 parent 312a7a8 commit 3d2e059
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kong/runloop/balancer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,7 @@ local function execute(target, ctx)
target.hash_value = hash_value
end

if not ctx.service.client_certificate then
if ctx and ctx.service and not ctx.service.client_certificate then
-- service level client_certificate is not set
local cert, res, err
local client_certificate = upstream.client_certificate
Expand Down

0 comments on commit 3d2e059

Please sign in to comment.