[sheepdog] [PATCH v2] lib/logger: nonblocking waitpid to avoid sheep process cannot exit
Liu Yuan
namei.unix at gmail.com
Wed Jun 11 08:14:32 CEST 2014
On Wed, Jun 11, 2014 at 10:53:35AM +0800, Ruoyu wrote:
> Sometimes sheep process cannot exit as we expected. I think the
> point might be the sequential problem by using waitpid, the
> system call waiting for process to change state.
>
> Current log_close function calling waitpid as a void method. It
> will block the main process. Suppose this situation:
>
> Father: --> active=false --------------------------------> waitpid
> Child: -------------> active=true --> while(active) do sth. -->
>
> The log process will loop forever so that the main process cannot
> exit.
>
> Therefore, it is better to retrieve the return value and pass the
> nonblocking flag WNOHANG to it. Moreover, reset share memory flag
> before each time calling waitpid.
>
> Signed-off-by: Ruoyu <liangry at ucweb.com>
> ---
Applied thanks
Yuan
More information about the sheepdog
mailing list