-
Notifications
You must be signed in to change notification settings - Fork 63
double confirm the process has already been started #286
Conversation
jenkins failed due to the serial port breaking issue. retest this please, hykins |
both jenkins and one job of travis failed due to hyperhq/hyperd#555 , wonder if this patch increases its hit probability. |
src/exec.c
Outdated
@@ -563,9 +563,14 @@ static void hyper_exec_process(struct hyper_exec *exec, struct stdio_config *io) | |||
|
|||
setsid(); | |||
|
|||
if (pipe > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is always true.
src/exec.c
Outdated
@@ -563,9 +563,14 @@ static void hyper_exec_process(struct hyper_exec *exec, struct stdio_config *io) | |||
|
|||
setsid(); | |||
|
|||
if (pipe > 0) { | |||
//send success notification before stdio was installed, otherwise it will be sent to user tty. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise the debug log in hyper_send_type() will be sent to user tty.
} | ||
|
||
//two message may come back in reversed sequence | ||
exec->pid = (type == 0) ? cpid : type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is time for converting success-notification-pipes to eventfd....
(not reqired in this pr)
retest this please, hykins |
src/exec.c
Outdated
@@ -581,6 +584,10 @@ static void hyper_exec_process(struct hyper_exec *exec, struct stdio_config *io) | |||
} | |||
|
|||
exit: | |||
if (pipe > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls remove this check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
o... missed
Having sent pid, the container might have not been started well, a signal comes at this time may not take into effect. see hyperhq#285 Signed-off-by: Wang Xu <gnawux@gmail.com>
backport hyperhq#286 to maintenance_1 Signed-off-by: Wang Xu <gnawux@gmail.com>
EDIT: simplified the implementation
Having sent pid, the container might have not been started well, a signal comes at this time may not take into effect. see #285
as described in #285, looks send back pid too early may lead to a race conditionif a signal comes right after the init container request.In this commit, I try to delay sending back the pid, which is a bit complicatedbecause the pid can not get with getpid(2) in the child process as it is in a new ns.Signed-off-by: Wang Xu gnawux@gmail.com