mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
sd-notify: do not hang when NOTIFY_SOCKET is used with create
if NOTIFY_SOCKET is used, do not block the main runc process waiting for events on the notify socket. Bind mount the parent directory of the notify socket, so that "start" can create the socket and it is still accessible from the container. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
+10
-2
@@ -408,7 +408,9 @@ func startContainer(context *cli.Context, spec *specs.Spec, action CtAct, criuOp
|
||||
|
||||
notifySocket := newNotifySocket(context, os.Getenv("NOTIFY_SOCKET"), id)
|
||||
if notifySocket != nil {
|
||||
notifySocket.setupSpec(context, spec)
|
||||
if err := notifySocket.setupSpec(context, spec); err != nil {
|
||||
return -1, err
|
||||
}
|
||||
}
|
||||
|
||||
container, err := createContainer(context, id, spec)
|
||||
@@ -417,10 +419,16 @@ func startContainer(context *cli.Context, spec *specs.Spec, action CtAct, criuOp
|
||||
}
|
||||
|
||||
if notifySocket != nil {
|
||||
err := notifySocket.setupSocket()
|
||||
err := notifySocket.setupSocketDirectory()
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
if action == CT_ACT_RUN {
|
||||
err := notifySocket.bindSocket()
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Support on-demand socket activation by passing file descriptors into the container init process.
|
||||
|
||||
Reference in New Issue
Block a user