Skip to content

Commit

Permalink
fix(core): always pass ngx.ctx to log_init_worker_errors (#13731)
Browse files Browse the repository at this point in the history
Signed-off-by: Aapo Talvensaari <[email protected]>
  • Loading branch information
bungle authored Nov 12, 2024
1 parent 7047692 commit fd7ea93
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: |
Fix to always pass `ngx.ctx` to `log_init_worker_errors` as otherwise it may runtime crash.
type: bugfix
scope: Core
16 changes: 10 additions & 6 deletions kong/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1962,10 +1962,12 @@ end
Kong.status_header_filter = Kong.admin_header_filter


function Kong.serve_cluster_listener(options)
log_init_worker_errors()
function Kong.serve_cluster_listener()
local ctx = ngx.ctx

log_init_worker_errors(ctx)

ngx.ctx.KONG_PHASE = PHASES.cluster_listener
ctx.KONG_PHASE = PHASES.cluster_listener

return kong.clustering:handle_cp_websocket()
end
Expand All @@ -1976,10 +1978,12 @@ function Kong.stream_api()
end


function Kong.serve_cluster_rpc_listener(options)
log_init_worker_errors()
function Kong.serve_cluster_rpc_listener()
local ctx = ngx.ctx

log_init_worker_errors(ctx)

ngx.ctx.KONG_PHASE = PHASES.cluster_listener
ctx.KONG_PHASE = PHASES.cluster_listener

return kong.rpc:handle_websocket()
end
Expand Down

1 comment on commit fd7ea93

@github-actions
Copy link
Contributor

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:fd7ea937652a84771c25141a7f416f775d44aaf7
Artifacts available https://github.com/Kong/kong/actions/runs/11803527002

Please sign in to comment.