From 3dd0321b1042dd636bb5b6fc330442cc1e734bb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20M=C3=BCthing?= Date: Fri, 8 Sep 2017 10:15:42 +0200 Subject: [PATCH] Make systemd socket activation actually work MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When trying socket activation for my Docker network plugin, I noticed that the first request to the plugin never reached the plugin. As it turns out, the relevant code for extracting the passed-in socket from systemd never got called. I think this caused systemd to failover, cede the socket and try running the plugin normally, but at that point, docker already hangs. Signed-off-by: Steffen Müthing --- sdk/unix_listener.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sdk/unix_listener.go b/sdk/unix_listener.go index 54b9a6d..897a078 100644 --- a/sdk/unix_listener.go +++ b/sdk/unix_listener.go @@ -17,7 +17,13 @@ func newUnixListener(pluginName string, gid int) (net.Listener, string, error) { if err != nil { return nil, "", err } - listener, err := sockets.NewUnixSocket(path, gid) + // try systemd socket activation first + listener, err := setupSocketActivation() + if err == nil { + return listener, path, nil + } + + listener, err = sockets.NewUnixSocket(path, gid) if err != nil { return nil, "", err }