diff options
author | Griffin Smith <grfn@gws.fyi> | 2020-08-29T03·17-0400 |
---|---|---|
committer | glittershark <grfn@gws.fyi> | 2020-09-01T01·07+0000 |
commit | c5f3b12f0484cd1a5152b6c64a336e9852d7c484 (patch) | |
tree | 25a14ecc81243b2c0cee95c06071d93a1b1481af /absl/base/optimization.h | |
parent | e472aa016e4d8bef79930d750c65e40ce21dba3a (diff) |
feat(tvix): Support systemd socket activation r/1755
When the nix daemon starts up, first check (using sd_listen_fds) whether we have been systemd socket-activated. If so, instead of passing the nix daemon socket path to grpc, start a manual accept(2) loop, passing the client file descriptors to grpc via AddInsecureChannelFromFd. There's an open grpc issue at https://github.com/grpc/grpc/issues/19133 for building support into grpc to do this automatically, but as of right now this appears to be the only way to make this happen. Making this happen, by the way, was a bit of a journey - at one point I attempted to ServerBuilder's experimental AddExternalConnectionAcceptor API, and that didn't work either - it appears that the final missing piece to getting this working was explicitly fcntl(2)ing the client file descriptors to set O_NONBLOCK before passing them into gRPC. With that set, this all works inside of the test vm. Fixes: b/56 Change-Id: I5d2ab2b5b02eb570249b30a9674e115c61b0ab0e Reviewed-on: https://cl.tvl.fyi/c/depot/+/1882 Reviewed-by: kanepyork <rikingcoding@gmail.com> Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
Diffstat (limited to 'absl/base/optimization.h')
0 files changed, 0 insertions, 0 deletions