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
Add 'set-proc-title' config so that this mechanism can be disabled #3623
Conversation
nobody care this? thanks. |
This is very important when running several unixsock-binded server on the same machine.Hope this can be merged. |
This makes sense to me, @redis/core-team any other thoughts? |
i agree with the idea of a flag to avoid changing the process title at all. |
we've requiring this option since 2004, and doing manual patch since then. The default value of setproctitle can be changed to yes (to be consistent with redis's current behaviour). |
i'm ok merging it with a default of @@ -5606,8 +5606,9 @@ void redisSetProcTitle(char *title) {
if (server.cluster_enabled) server_mode = " [cluster]";
else if (server.sentinel_mode) server_mode = " [sentinel]";
- setproctitle("%s %s:%d%s",
+ setproctitle("%s %s %s:%d%s",
title,
+ server.configfile ? server.configfile : "-",
server.bindaddr_count ? server.bindaddr[0] : "*",
server.port ? server.port : server.tls_port,
server_mode); |
@oranagra ok,I'll change the default value to yes. About your change on the proc title, it's ok to add configfile in, but sometimes I prefer to keep the command line intact, so add an option is still required in my case. |
I would be most inclined to:
|
if option `setproctitle' is no, then do nothing for proc title. The reason has been explained long ago, see following: We update redis to 2.8.8, then found there are some side effect when redis always change the process title. We run several slave instance on one computer, and all these salves listen on unix socket only, then ps will show: 1 S redis 18036 1 0 80 0 - 56130 ep_pol 14:02 ? 00:00:31 /usr/sbin/redis-server *:0 1 S redis 23949 1 0 80 0 - 11074 ep_pol 15:41 ? 00:00:00 /usr/sbin/redis-server *:0 for redis 2.6 the output of ps is like following: 1 S redis 18036 1 0 80 0 - 56130 ep_pol 14:02 ? 00:00:31 /usr/sbin/redis-server /etc/redis/a.conf 1 S redis 23949 1 0 80 0 - 11074 ep_pol 15:41 ? 00:00:00 /usr/sbin/redis-server /etc/redis/b.conf Later is more informational in our case. The situation is worse when we manage the config and process running state by salt. Salt check the process by running "ps | grep SIG" (for Gentoo System) to check the running state, where SIG is the string to search for when looking for the service process with ps. Previously, we define sig as "/usr/sbin/redis-server /etc/redis/a.conf". Since the ps output is identical for our case, so we have no way to check the state of specified redis instance. So, for our case, we prefer the old behavior, i.e, do not change the process title for the main redis process. Or add an option such as "setproctitle [yes|no]" to control this behavior. There are some discussion in issue redis#694, redis#1979, redis#2081, but in our case, keep the title untouched is the best option, thanks.
i'm good with @madolson proposal, when TCP port is not present, show the unix socket name instead of 0. in addition to that we can either add an optional |
@oranagra I don't mind to add more content to the proc title, and it's a better step over current implementation. |
+1 for reporting Unix socket. I think this along with the option to turn off setproctitle should address this fully. As for an instance name, I'm not basically against this idea but I think it should be considered in a bigger context so I would avoid doing that as part of this localized fix. |
@yossigo so you'd like to avoid
regarding showing the unix socket, do we show it always (when present), or only when the TCP port is unset? (more backwards compatible) |
Basically, I don't against this option, since what this PR requested is included in. |
* Use set-proc-title as a config keyword. * Add an example redis.conf entry and description.
@clan This feature could arguably be avoided in the first place, especially given the trouble we had recently with Added a few minor changes to your PR. Thanks for your patience! |
@yossigo thanks. and yes, I understand the importance to don't break user's exist code silently. |
I am fine with doing doing instance-name later as well. |
7de9f30
…edis#3623) if option `set-proc-title' is no, then do nothing for proc title. The reason has been explained long ago, see following: We update redis to 2.8.8, then found there are some side effect when redis always change the process title. We run several slave instance on one computer, and all these salves listen on unix socket only, then ps will show: 1 S redis 18036 1 0 80 0 - 56130 ep_pol 14:02 ? 00:00:31 /usr/sbin/redis-server *:0 1 S redis 23949 1 0 80 0 - 11074 ep_pol 15:41 ? 00:00:00 /usr/sbin/redis-server *:0 for redis 2.6 the output of ps is like following: 1 S redis 18036 1 0 80 0 - 56130 ep_pol 14:02 ? 00:00:31 /usr/sbin/redis-server /etc/redis/a.conf 1 S redis 23949 1 0 80 0 - 11074 ep_pol 15:41 ? 00:00:00 /usr/sbin/redis-server /etc/redis/b.conf Later is more informational in our case. The situation is worse when we manage the config and process running state by salt. Salt check the process by running "ps | grep SIG" (for Gentoo System) to check the running state, where SIG is the string to search for when looking for the service process with ps. Previously, we define sig as "/usr/sbin/redis-server /etc/redis/a.conf". Since the ps output is identical for our case, so we have no way to check the state of specified redis instance. So, for our case, we prefer the old behavior, i.e, do not change the process title for the main redis process. Or add an option such as "set-proc-title [yes|no]" to control this behavior. Co-authored-by: Yossi Gottlieb <yossigo@gmail.com> Co-authored-by: Oran Agra <oran@redislabs.com>
if option `setproctitle' is no, then do nothing for proc title.
The reason has been explained in here, with the copy bellow.
We update redis to 2.8.8, then found there are some side effect when redis always change the process title.
We run several slave instance on one computer, and all these salves listen on unix socket only, then ps will show:
1 S redis 18036 1 0 80 0 - 56130 ep_pol 14:02 ? 00:00:31 /usr/sbin/redis-server *:0
1 S redis 23949 1 0 80 0 - 11074 ep_pol 15:41 ? 00:00:00 /usr/sbin/redis-server *:0
for redis 2.6 the output of ps is like following:
1 S redis 18036 1 0 80 0 - 56130 ep_pol 14:02 ? 00:00:31 /usr/sbin/redis-server /etc/redis/a.conf
1 S redis 23949 1 0 80 0 - 11074 ep_pol 15:41 ? 00:00:00 /usr/sbin/redis-server /etc/redis/b.conf
Later is more informational in our case. The situation is worse when we manage the config and process running state by salt. Salt check the process by running "ps | grep SIG" (for Gentoo System) to check the running state, where SIG is the string to search for when looking for the service process with ps. Previously, we define sig as "/usr/sbin/redis-server /etc/redis/a.conf". Since the ps output is identical for our case, so we have no way to check the state of specified redis instance.
So, for our case, we prefer the old behavior, i.e, do not change the process title for the main redis process. Or add an option such as "setproctitle [yes|no]" to control this behavior.
There are some discussion in issue #694 , #1979, #2081 , but in our case, keep the title untouched is the best option, thanks.