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

Radostin Stoyanov rstoyanov1 at gmail.com
Mon Jul 9 21:43:20 MSK 2018


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.

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



More information about the CRIU mailing list