From 78bdc4eaca1a092e89686cc0dd91fae8f371e6e7 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Mon, 14 Feb 2022 20:53:31 +0100 Subject: [PATCH] Backend ignore of SIGPIPE. This occurs if client quits unexpectedly over the UNIX socket. This is a timing issue but occurs more frequently in large RESTCONF messgaes. --- CHANGELOG.md | 6 +++++- apps/backend/backend_main.c | 5 +++++ lib/src/clixon_proto.c | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70c8f94f..baf2da92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,13 +51,17 @@ Users may have to change how they access the system ### Minor features +* Backend ignore of SIGPIPE. This occurs if client quits unexpectedly over the UNIX socket. + * This is a timing issue but occurs more frequently in large RESTCONF messgaes. * New `clixon-config@2022-02-11.yang` revision * Added option: `CLICON_LOG_STRING_LIMIT` * Limit the length of log and debug messages. Some log messages are dependendent on sizes that can be very large, such as packet lengths. This new option constrains the length of all messgaes. By default no limits. - ### Corrected Bugs + + + * Fixed: input RPC validation of choice (non-case) * Fixed: More than one unknown/extension in combination with augment of extension resulted in extension being skipped. diff --git a/apps/backend/backend_main.c b/apps/backend/backend_main.c index 065dd696..611e0eec 100644 --- a/apps/backend/backend_main.c +++ b/apps/backend/backend_main.c @@ -1021,6 +1021,11 @@ main(int argc, clicon_err(OE_DAEMON, errno, "Setting signal"); goto done; } + /* Client exit in the middle of a transaction, handled in clicon_msg_send */ + if (set_signal(SIGPIPE, SIG_IGN, NULL) < 0){ + clicon_err(OE_DAEMON, errno, "Setting signal"); + goto done; + } /* Initialize server socket and save it to handle */ if ((ss = backend_server_socket(h)) < 0) goto done; diff --git a/lib/src/clixon_proto.c b/lib/src/clixon_proto.c index 8be2fb98..6744a87f 100644 --- a/lib/src/clixon_proto.c +++ b/lib/src/clixon_proto.c @@ -278,6 +278,8 @@ atomicio(ssize_t (*fn) (int, void *, size_t), continue; else if (errno == ECONNRESET)/* Connection reset by peer */ res = 0; + else if (errno == EPIPE) /* Client shutdown */ + res = 0; /* SIGPIPE if client is killed */ case 0: /* fall thru */ return (res);