[CRIU] [PATCH] image-cache: Ignore SIGPIPE

Andrei Vagin avagin at virtuozzo.com
Wed Jul 11 09:46:42 MSK 2018


On Mon, Jul 09, 2018 at 07:43:20PM +0100, Radostin Stoyanov wrote:
> During restore, the function send_image_async() is writing to a socket.
> However, this might fail with EPIPE (Broken pipe), causing the image-cache
> process to receive SIGPIPE.

SIGPIPE means that we are trying to write into a socket which was closed
from another side. Usually, this means that something is going wrong,
isn't it?

> 
> The default behaviour for this signal is to terminate the process, causing
> the restore to fail with:
> 
>     Restore side is calling finish
>     Error (criu/img-remote.c:287): Unable to connect to local socket: img-cache.sock: Connection refused
>     Error (criu/img-remote.c:1093): Error opening local connection for RESTORE_FINISH:null
>     Error (criu/img-remote.c:1154): Unable to open finish restore connection
>     Error (criu/cr-restore.c:2661): Finish remote restore failed.
> 
> This patch is ignores SIGPIPE and allows the send_image_async() to
> handle EPIPE.
> 
> Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>
> ---
>  criu/img-remote.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/criu/img-remote.c b/criu/img-remote.c
> index f148e23f..9d1cd347 100644
> --- a/criu/img-remote.c
> +++ b/criu/img-remote.c
> @@ -925,6 +925,7 @@ void accept_image_connections() {
>  			pr_perror("Failed to add proxy to cache fd to epoll");
>  			goto end;
>  		}
> +		signal(SIGPIPE, SIG_IGN);
>  	}
>  
>  	while (1) {
> -- 
> 2.17.1
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list