Ack with the following comments:

(a) 
> +                             if (w_pid < 0) {
> +                                     break;
in this case, we might want to continue when its EINTR
i.e. if (errno == EINTR)
         continue;
     else
         break;

(b) Perhaps we could have a flag to enable/disable coredumps, something like 
the way
it is done in /etc/init.d/opensafd script i.e. #enable_coredump()!?

Thanks,
Mathi.

----- [email protected] wrote:

> osaf/services/infrastructure/nid/nodeinit.c |  24
> ++++++++++++++++++++++++
>  1 files changed, 24 insertions(+), 0 deletions(-)
> 
> 
> diff --git a/osaf/services/infrastructure/nid/nodeinit.c
> b/osaf/services/infrastructure/nid/nodeinit.c
> --- a/osaf/services/infrastructure/nid/nodeinit.c
> +++ b/osaf/services/infrastructure/nid/nodeinit.c
> @@ -1108,6 +1108,30 @@ void cleanup(NID_SPAWN_INFO *service)
>       nid_close_ipc();
>       select_fd = -1;
>  
> +     pid_t w_pid;
> +     int status;
> +     uint32_t no_of_retries = 0;
> +     const uint32_t MAX_NO_RETRIES = 5;
> +
> +     if (check_process(service)) {
> +             // send abort signal to process to generate a core dump
> +             LOG_ER("Sending SIGABRT to %s, pid=%d", service->serv_name,
> service->pid);
> +             if (kill(service->pid, SIGABRT) >= 0) {
> +                     // wait a short period for process to exit
> +                     do {
> +                             w_pid = waitpid(service->pid, &status, WNOHANG);
> +                             if (w_pid < 0) {
> +                                     break;
> +                             } else {
> +                                     if (!WIFEXITED(status) && 
> !WIFSIGNALED(status)) {
> +                                             sleep(1);
> +                                     }
> +                             }
> +                     } while (!WIFEXITED(status) && !WIFSIGNALED(status) &&
> ++no_of_retries < MAX_NO_RETRIES);
> +             }
> +     }
> +
> +     // if sending abort signal did not succeed, fallback to sigkill
>       if (check_process(service)) {
>               LOG_ER("Sending SIGKILL to %s, pid=%d", service->serv_name,
> service->pid);
>               kill(service->pid, SIGKILL);

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to