Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): always pass ngx.ctx to log_init_worker_errors #13731

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this msg is very technical, could you make it more customer-friendly?

Copy link
Member Author

@bungle bungle Oct 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ADD-SP there is no way to make it customer friendly. Thus I was thinking about removing the whole changelog. But then I though people start complaining that it is not there. It is internal change that I am not sure has anyone expect me hit. If you are looking after something like "Made Kong more robust when logging errors when starting a node". Then customers start to ask "how it is now more robust, should I know more about this".

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 @@ -1952,10 +1952,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 @@ -1966,10 +1968,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
Loading