On Wed, Mar 09, 2016 at 03:51:57AM +0000, Eric Wong wrote:
Amir Yalon <[email protected]> wrote:
Yes, everything looks as expected, one inherited socket starting at fd
number 3:
I=[3] PID=4869 FDS=1
Also tried with Ruby 2.2.1, same results. FWIW, my rubies are compiled
by system-wide RVM with no special options given to it.
Interesting. Can you try using some other non-Ruby daemon
which uses sd_listen_fds, too? I can't think of any off
the top of my head, but I'm sure there's some.
It seems like systemd is mis-setting FD_CLOEXEC on socket,
even.
Ok, this is my theory, systemd correctly passes the sockets and the
environment to the process, but Amir is using rvm which probably runs
one more exec than usual. In this extra step rvm/ruby closes the fds for
security reasons but the ENV variables remain. In the newly forked ruby
process the timer gets fd=3 (which is now consider internal) and when
unicorn tries to example fd=3 breaks.