Message ID | 1480084773-17817-1-git-send-email-christophe.milard@linaro.org |
---|---|
State | Accepted |
Commit | 9c4d778148d514adf8586939123acdcdc022e8e5 |
Headers | show |
ping This should be straightforward to review and would help (partly) avoiding hanging processes when killing ODP (e.g. ctrl-C) Thanks On 2016-11-25 15:39, Christophe Milard wrote: > _fdserver now request SIGTERM if parent process (ODP instantiation > process) dies, hence avoiding it to become orphan and reattached to the > init process. > > Signed-off-by: Christophe Milard <christophe.milard@linaro.org> > --- > platform/linux-generic/_fdserver.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/platform/linux-generic/_fdserver.c b/platform/linux-generic/_fdserver.c > index 41a630b..9aed7a9 100644 > --- a/platform/linux-generic/_fdserver.c > +++ b/platform/linux-generic/_fdserver.c > @@ -41,6 +41,8 @@ > #include <odp_internal.h> > #include <odp_debug_internal.h> > #include <_fdserver_internal.h> > +#include <sys/prctl.h> > +#include <signal.h> > > #include <stdio.h> > #include <stdlib.h> > @@ -622,6 +624,10 @@ int _odp_fdserver_init_global(void) > /* TODO: pin the server on appropriate service cpu mask */ > /* when (if) we can agree on the usage of service mask */ > > + /* request to be killed if parent dies, hence avoiding */ > + /* orphans being "adopted" by the init process... */ > + prctl(PR_SET_PDEATHSIG, SIGTERM); > + > /* allocate the space for the file descriptor<->key table: */ > fd_table = malloc(FDSERVER_MAX_ENTRIES * sizeof(fdentry_t)); > if (!fd_table) { > -- > 2.7.4 >
Christophe Do you have a way I can create the problem and then prove to myself you fixed it by applying this? Can I CTRL C any of our apps ? Mike On 30 November 2016 at 03:34, Christophe Milard < christophe.milard@linaro.org> wrote: > ping > > This should be straightforward to review and would help (partly) avoiding > hanging processes when killing ODP (e.g. ctrl-C) > Thanks > > On 2016-11-25 15:39, Christophe Milard wrote: > > _fdserver now request SIGTERM if parent process (ODP instantiation > > process) dies, hence avoiding it to become orphan and reattached to the > > init process. > > > > Signed-off-by: Christophe Milard <christophe.milard@linaro.org> > > --- > > platform/linux-generic/_fdserver.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/platform/linux-generic/_fdserver.c > b/platform/linux-generic/_fdserver.c > > index 41a630b..9aed7a9 100644 > > --- a/platform/linux-generic/_fdserver.c > > +++ b/platform/linux-generic/_fdserver.c > > @@ -41,6 +41,8 @@ > > #include <odp_internal.h> > > #include <odp_debug_internal.h> > > #include <_fdserver_internal.h> > > +#include <sys/prctl.h> > > +#include <signal.h> > > > > #include <stdio.h> > > #include <stdlib.h> > > @@ -622,6 +624,10 @@ int _odp_fdserver_init_global(void) > > /* TODO: pin the server on appropriate service cpu mask */ > > /* when (if) we can agree on the usage of service mask */ > > > > + /* request to be killed if parent dies, hence avoiding */ > > + /* orphans being "adopted" by the init process... */ > > + prctl(PR_SET_PDEATHSIG, SIGTERM); > > + > > /* allocate the space for the file descriptor<->key table: > */ > > fd_table = malloc(FDSERVER_MAX_ENTRIES * > sizeof(fdentry_t)); > > if (!fd_table) { > > -- > > 2.7.4 > > > -- Mike Holmes Program Manager - Linaro Networking Group Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs "Work should be fun and collaborative, the rest follows"
On 11/30/16 15:48, Mike Holmes wrote: > Christophe > > Do you have a way I can create the problem and then prove to myself > you fixed it by applying this? > Can I CTRL C any of our apps ? > > Mike > yes, Mike, I asked for that change. run something like make check and watch for background processes with ps -ax (without patch there has to process which hangs, after patch it works great according to my tests). Maxim. > On 30 November 2016 at 03:34, Christophe Milard > <christophe.milard@linaro.org <mailto:christophe.milard@linaro.org>> > wrote: > > ping > > This should be straightforward to review and would help (partly) > avoiding > hanging processes when killing ODP (e.g. ctrl-C) > Thanks > > On 2016-11-25 15:39, Christophe Milard wrote: > > _fdserver now request SIGTERM if parent process (ODP instantiation > > process) dies, hence avoiding it to become orphan and reattached > to the > > init process. > > > > Signed-off-by: Christophe Milard <christophe.milard@linaro.org > <mailto:christophe.milard@linaro.org>> > > --- > > platform/linux-generic/_fdserver.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/platform/linux-generic/_fdserver.c > b/platform/linux-generic/_fdserver.c > > index 41a630b..9aed7a9 100644 > > --- a/platform/linux-generic/_fdserver.c > > +++ b/platform/linux-generic/_fdserver.c > > @@ -41,6 +41,8 @@ > > #include <odp_internal.h> > > #include <odp_debug_internal.h> > > #include <_fdserver_internal.h> > > +#include <sys/prctl.h> > > +#include <signal.h> > > > > #include <stdio.h> > > #include <stdlib.h> > > @@ -622,6 +624,10 @@ int _odp_fdserver_init_global(void) > > /* TODO: pin the server on appropriate service cpu > mask */ > > /* when (if) we can agree on the usage of service > mask */ > > > > + /* request to be killed if parent dies, hence > avoiding */ > > + /* orphans being "adopted" by the init process... > */ > > + prctl(PR_SET_PDEATHSIG, SIGTERM); > > + > > /* allocate the space for the file > descriptor<->key table: */ > > fd_table = malloc(FDSERVER_MAX_ENTRIES * > sizeof(fdentry_t)); > > if (!fd_table) { > > -- > > 2.7.4 > > > > > > > -- > Mike Holmes > Program Manager - Linaro Networking Group > Linaro.org <http://www.linaro.org/>***│ *Open source software for ARM SoCs > "Work should be fun and collaborative, the rest follows" >
Merged, Reviewed-by: Mike Holmes <mike.holmes@linaro.,org> from email with API-NEXT tag. Maxim. On 11/30/16 15:48, Mike Holmes wrote: > Christophe > > Do you have a way I can create the problem and then prove to myself you > fixed it by applying this? > Can I CTRL C any of our apps ? > > Mike > > On 30 November 2016 at 03:34, Christophe Milard > <christophe.milard@linaro.org <mailto:christophe.milard@linaro.org>> wrote: > > ping > > This should be straightforward to review and would help (partly) > avoiding > hanging processes when killing ODP (e.g. ctrl-C) > Thanks > > On 2016-11-25 15:39, Christophe Milard wrote: > > _fdserver now request SIGTERM if parent process (ODP instantiation > > process) dies, hence avoiding it to become orphan and reattached > to the > > init process. > > > > Signed-off-by: Christophe Milard <christophe.milard@linaro.org > <mailto:christophe.milard@linaro.org>> > > --- > > platform/linux-generic/_fdserver.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/platform/linux-generic/_fdserver.c > b/platform/linux-generic/_fdserver.c > > index 41a630b..9aed7a9 100644 > > --- a/platform/linux-generic/_fdserver.c > > +++ b/platform/linux-generic/_fdserver.c > > @@ -41,6 +41,8 @@ > > #include <odp_internal.h> > > #include <odp_debug_internal.h> > > #include <_fdserver_internal.h> > > +#include <sys/prctl.h> > > +#include <signal.h> > > > > #include <stdio.h> > > #include <stdlib.h> > > @@ -622,6 +624,10 @@ int _odp_fdserver_init_global(void) > > /* TODO: pin the server on appropriate service cpu > mask */ > > /* when (if) we can agree on the usage of service > mask */ > > > > + /* request to be killed if parent dies, hence > avoiding */ > > + /* orphans being "adopted" by the init process... > */ > > + prctl(PR_SET_PDEATHSIG, SIGTERM); > > + > > /* allocate the space for the file descriptor<->key > table: */ > > fd_table = malloc(FDSERVER_MAX_ENTRIES * > sizeof(fdentry_t)); > > if (!fd_table) { > > -- > > 2.7.4 > > > > > > > -- > Mike Holmes > Program Manager - Linaro Networking Group > Linaro.org <http://www.linaro.org/>* **│ *Open source software for ARM SoCs > "Work should be fun and collaborative, the rest follows" > > __ > >
diff --git a/platform/linux-generic/_fdserver.c b/platform/linux-generic/_fdserver.c index 41a630b..9aed7a9 100644 --- a/platform/linux-generic/_fdserver.c +++ b/platform/linux-generic/_fdserver.c @@ -41,6 +41,8 @@ #include <odp_internal.h> #include <odp_debug_internal.h> #include <_fdserver_internal.h> +#include <sys/prctl.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> @@ -622,6 +624,10 @@ int _odp_fdserver_init_global(void) /* TODO: pin the server on appropriate service cpu mask */ /* when (if) we can agree on the usage of service mask */ + /* request to be killed if parent dies, hence avoiding */ + /* orphans being "adopted" by the init process... */ + prctl(PR_SET_PDEATHSIG, SIGTERM); + /* allocate the space for the file descriptor<->key table: */ fd_table = malloc(FDSERVER_MAX_ENTRIES * sizeof(fdentry_t)); if (!fd_table) {
_fdserver now request SIGTERM if parent process (ODP instantiation process) dies, hence avoiding it to become orphan and reattached to the init process. Signed-off-by: Christophe Milard <christophe.milard@linaro.org> --- platform/linux-generic/_fdserver.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.7.4