-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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): ensure absolute path is used for event sock #9337
Conversation
f8efa5b
to
75e85eb
Compare
@flrgh There is a related issue; Pongo is having permission issues with this unix socket. The problem is that in Pongo, the
We had the same issue with Vagrant a long time ago (because test nginx uses unix sockets as well), it was fixed like this: https://github.com/Kong/kong-vagrant/blob/master/provision.sh#L331-L332 So besides making it an absolute path, it should also become configurable by an env var. EDIT: added the error message |
ff4c977
to
656f827
Compare
Once this is approved, send cherry-pick against |
5cc60cb
to
ea32c08
Compare
👋 hi folks, I want to back things up a bit here, because this PR has seen some scope creep while I was out on vacation. The original bugfix commit (4158cee) that prompted this PR was intended to address a very simple bug--we were using a relative path in a place where we ought to be using an absolute path, causing a fatal error. It has since been pushed beyond the The bugfix is not mutually-exclusive with the notion of a new config field (even if the latter eventually supplants the work of the former). Additionally, I see no reason that these two things (the fix and the new config field) need to happen in the same PR. Therefore, unless anyone has a compelling case to make otherwise, I'd like to return this branch/PR to it's prior state+scope, because I don't want the bugfix to be held back while the merits and implementation details of the feature are still being sorted out. The socket path change for Pongo can then be carried out in another PR. |
My thoughts re: Pongo and unix sockets The worker events socket is not the only unix socket that Kong places in the |
79b9e8d
to
2590e88
Compare
I restored the branch to the original 2 bugfix items (with a couple style fixes) and rebased onto master. This is ready for another round of review. |
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.
I am still not convinced why the socket path needs to be configurable in the first place. If we need to fix the relative path issue, we should do just that and nothing more. Please share your reasoning in the ticket before merging anything.
You are right. |
b9b05fc
to
22f2025
Compare
22f2025
to
db8e310
Compare
This fixes an issue with how Kong initializes resty.events. The code was previously using `ngx.config.prefix()` to determine the listening socket path to provide to the resty.events module. This causes breakage when NGINX is started with a relative path prefix: > failed to instantiate 'kong.worker_events' module: failed to disable listening: unix:my-prefix/worker_events.sock Instead of using `ngx.config.prefix()`, Kong will now prefer `kong.configuration.prefix` when available, as it is already normalized to an absolute path. If `kong.configuration.prefix` is not defined, the result of `ngx.config.prefix()` will be used after resolving it to an absolute path.
db8e310
to
9d83910
Compare
Datong changed this PR in order to contain the relative path solution #9337 (comment)
Summary
This fixes an issue with how Kong initializes resty.events. The code was
previously using
ngx.config.prefix()
to determine the listening socketpath to provide to the resty.events module. This causes breakage when
NGINX is started with a relative path prefix:
Instead of using
ngx.config.prefix()
, Kong will now preferkong.configuration.prefix
when available, as it is already normalizedto an absolute path. If
kong.configuration.prefix
is not defined, theresult of
ngx.config.prefix()
will be used after resolving it to anabsolute path.
Also contains an unrelated fix in
kong/cmd/start.lua
.Full changelog
kong.configuration.prefix
tongx.config.prefix()
ngx.config.prefix()
to an absolute path before using itkong.cmd.start