While this is not a big issue, I would like to understand the following behavior:

  1. I run the following steps to start up the redis-server (in daemon mode according to the "daemonize" parameter in the config file:
export MY_ENV_VAR=abcd
export ANOTHER=bcde

redis-server /path/to/redis.conf
  1. I try to view the environment variables for the process by inspecting /proc/<pid>/environ on UBUNTU. However, I don't see anything there.

Comment From: antirez

Hello @abh1kg, I'm not sure, but I believe this has to do with the way we rewrite the process name... I'll check better since indeed it is interesting to understand what's happening here.

Comment From: abh1kg

Thanks a lot for the reply @antirez . I did some digging on my own and found that the setproctitle.c is responsible for removing the environment completely. I could not find the reason for doing this though :)

Comment From: abh1kg

@antirez: Do you plan to provide a fix for this? I can raise a pull but would it be possible to backport the fix onto earlier versions?

Comment From: yossigo

I don't think there's really a way to fix that due to how setproctitle works. The environment is not lost, it is copied and still available to the process itself but not where the kernel put it so it's not visible through /proc.