-
Notifications
You must be signed in to change notification settings - Fork 692
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
Reloading through SIGHUP kills uwsgi, unable to chown socket #1471
Comments
I'm seeing this as well. With the defaults on FreeBSD now uwsgi is started by root, creates the socket as www:www, and drops privileges to uwsgi user. This gives us nice isolation, but a SIGHUP causes it to close the unix and network sockets and attempt to re-open them. It fails because it no longer has root privileges so it can't recreate a socket owned by www:www, then terminates. I don't understand why a reload requires destroying the sockets... |
2.0.14 |
Any updates on this? |
* Changed socket uid/gid and mode, this should fix github issue #1471[1] [1] unbit/uwsgi#1471 PR: 210170 Submitted by: David Wahlund Reviewed by: matthew (mentor) Approved by: matthew (mentor) Differential Revision: https://reviews.freebsd.org/D12089 git-svn-id: svn+ssh://svn.freebsd.org/ports/head@448441 35697150-7ecd-e111-bb59-0022644237b5
* Changed socket uid/gid and mode, this should fix github issue #1471[1] [1] unbit/uwsgi#1471 PR: 210170 Submitted by: David Wahlund Reviewed by: matthew (mentor) Approved by: matthew (mentor) Differential Revision: https://reviews.freebsd.org/D12089
Note that above mentioned FreeBSD ports commits didn't fix this. |
The socket permissions were screwed for me upon updating to 2.0.15 from 2.0.13 on FreeBSD. |
I have the same problem when I moved to 2.0.15 on FreeBSD 11.1 RELEASE. I solved this just now by setting uwsgi to run as www and the socket owner to www: The socket is then owned by www and the SIGHUP reload works as expected. Setting those to default UID to uwsgi and socket_owner to uwsgi results in failure. The socket is owned by uwsgi and the uwsgi processes are running as uwsgi. Something just doesn't make sense here... Why does one unprivileged user work and another doesn't? |
This is to note that @theory14's solution did not work for me on FreeBSD 11.1 in a jail with uwsgi-py36-2.0.15_3… |
I've faced this issue for over a year on FreeBSD. I still don't have a solution to this. I have to kill -9 the emperor processes to stop UWSGI. |
|
I have the same problem with uwsgi 2.0.17.1 on FreeBSD 11.2 - for some reason Unix socket is not inherited after reload (SIGHUP).
|
As I can see problem is in function |
On FreeBSD unix socket path returned by getsockname() in uwsgi_add_socket_from_fd() can contain garbage trailing character(s). Clear structure before passing it to getsockname() as a workaround. Problem with reloading through SIGHUP on FreeBSD was also reported in unbit#1471
On FreeBSD unix socket path returned by getsockname() in uwsgi_add_socket_from_fd() can contain garbage trailing character(s). Clear structure before passing it to getsockname() as a workaround. Problem with reloading through SIGHUP on FreeBSD was also reported in #1471
I can still reproduce the problem with using the latest dev, |
Also with |
It seems that the two offending lines in rc_flags=${rc_flags}" --vassals-set uid=${uwsgi_uid} --vassals-set gid=${uwsgi_gid}"
rc_flags=${rc_flags}" --vassals-set chmod-socket=${uwsgi_socket_mode} --vassals-set chown-socket=${uwsgi_socket_owner}" Line 130-131. Commenting these two lines out will help uwsgi start/reload normally. I use the |
uwsgi running like this:
The config is pretty common - application is running under its own dedicated user
repology
, and socket is owned bywww
as it should be accessed by frontend (nginx running aswww
).when issuing SIGHUP, it dies with
in the log, likely because it's already running as
repology
and is thus unable to change socket ownership towww
.The text was updated successfully, but these errors were encountered: