From patchwork Tue Sep 22 03:08:07 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arturs Laizans X-Patchwork-Id: 2309409 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20251104 header.b=D1ytTzxb; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::53a; helo=mail-ed1-x53a.google.com; envelope-from=swupdate+bncbcfk3zpjwahrbo73zhkqmgqe2f5ns7q@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-ed1-x53a.google.com (mail-ed1-x53a.google.com [IPv6:2a00:1450:4864:20::53a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hq0lX2C1sz1xqn for ; Tue, 22 Sep 2026 23:08:22 +1000 (AEST) Received: by mail-ed1-x53a.google.com with SMTP id 4fb4d7f45d1cf-6a125f5b317sf5482504a12.1 for ; Tue, 22 Sep 2026 06:08:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20251104; t=1790082494; x=1790687294; darn=patchwork.ozlabs.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :content-type:mime-version:subject:message-id:to:from:date:from:to :cc:subject:date:message-id:reply-to:content-type; bh=qHy7kbq4Eaj846c5eU+IRO8fQSO8GJJuBivbm6+zCQg=; b=D1ytTzxbt83ovv8jajSjzxh+bjLcSMhhO/yxOvq+12jOxgvaubCUew1WJ+iQZ5goqD N78QZ5naN2+LwiACqkb5HkCy2eS1t19MSzQMT84pQQ4BEOD5+vgnu4BsU2tg/Na3HV8w 51+LfcodR3ejMTYp6OlJQ+ymEc0wMRmMhLUTrTMD8XIC3pU7Ml5vzKSaWJZsOSsQ29EL PHrPrzu8rzelijZ3N1uJu4ei45gRTmNLY3frZy5mwJyfY1675iZFFPQVLoBZhemu44o2 zXbvgvRJ0r/aFx1ZtLT2dThhEr69p44g5L4DWz7e0hPv69BHSCRkMSyJTq/IeSRjppF9 z/VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790082494; x=1790687294; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-sender:content-type:mime-version:subject:message-id:to :from:date:x-beenthere:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=qHy7kbq4Eaj846c5eU+IRO8fQSO8GJJuBivbm6+zCQg=; b=QClE3hojzo9rPuZ0qu8lOsRNny79Wv6Y26USKwqbTY4q3eXzpS5gEte8RAvqdA0MIv o7+hfIh/8iGlRb01BqqmeS8UxGt7TY29dt4KzBhsh9k7Aj25k+eBeLH9lv5AGYMvfyTb rvtJnB613fzVnK8vSS8JbfKINptURLptTh9bNuHuqNaKKad9fXH1UpRb/AUalgM8vDqL BYfKOFCAkmnlSkUz5l1jLR0YmU5oKr9wQ6tFRHCMhtpwbKas/SSnTBtkDy8QCPGSk1b8 CMt+K5hbJY1Bf6dZ1WOmHmEaSa7gZBf0HDF+xmW9gWOzDhbdnQpLXV41sHXp/toN/LXa piWg== X-Forwarded-Encrypted: i=1; AKwUvBwSy1vZ9Sf6Vyeq4loW9AyBQk6p59I1Q5JMTg+Vlw16ryk2aVyZK+6ZTaA3sktyo1TIsXm7HRXPlw==@patchwork.ozlabs.org X-Gm-Message-State: AFuF++kmmJUshWWE4BpZ4VawW3CFxDna7xGDoJ5REv4OX6E+VBkfO5U2 4yyvN9DDvuGj9NSY17ACbNQlNd6XH+H8jVwRTKGlLXuW1vuJ9w17+sYC X-Received: by 2002:a05:6402:254c:b0:6aa:a7c9:8c16 with SMTP id 4fb4d7f45d1cf-6aaa7c98f10mr1250309a12.35.1790082494070; Tue, 22 Sep 2026 06:08:14 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com; h="ATskLdfN75nYvRug9xhtqK+bHYV6DSEroITTtN4AkztCiqRiCg==" Received: by 2002:a05:6402:a514:10b0:6a6:60d0:d525 with SMTP id 4fb4d7f45d1cf-6aa1cf17754ls3442491a12.1.-pod-prod-00-eu-canary; Tue, 22 Sep 2026 06:08:10 -0700 (PDT) X-Received: by 2002:a17:907:c783:b0:c25:f7dc:2d9 with SMTP id a640c23a62f3a-c2a8d7681a6mr248539966b.26.1790082490492; Tue, 22 Sep 2026 06:08:10 -0700 (PDT) Date: Tue, 22 Sep 2026 06:08:07 -0700 (PDT) X-Patchwork-Original-From: "'Arturs Laizans' via swupdate" From: Arturs Laizans To: swupdate Message-Id: <72ec038f-df3f-4ad2-9c73-8241eab4b97en@googlegroups.com> Subject: [swupdate] [PATCH] install_from_file: Fix silent failure and add retries for post-update IPC MIME-Version: 1.0 X-Original-Sender: arturs.laizans@essensium.com X-Original-From: Arturs Laizans Reply-To: Arturs Laizans Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , From 77584022e56876c476c318f1dcb14fc3c43bba3c Mon Sep 17 00:00:00 2001 From: Arturs Laizans Date: Tue, 22 Sep 2026 14:51:53 +0200 Subject: [PATCH] install_from_file: Fix silent failure and add retries for post-update IPC When install_from_file() completes an installation successfully, endupdate() issues an ipc_postupdate() call to execute any post-update actions. However, if ipc_postupdate() fails (due to a transient socket connection error, busy IPC listener, or context-switch delay) or if the server responds with NACK, endupdate() silently overrides end_status to EXIT_FAILURE without logging any error message. As a result, users and frontends see: [INFO ] : SWUPDATE running : [install_from_file] : SWUpdate was successful ! immediately followed by the process exiting with status 1 and no indication of why the update was considered failed. Furthermore, unlike the start of install_from_file() which retries swupdate_async_start() up to 3 times with a 1-second delay to handle IPC listener readiness, endupdate() previously attempted ipc_postupdate() only once without retries, making it susceptible to transient socket races under high load. Add retry logic (up to 3 attempts with 1-second backoff) for transient IPC communication errors in endupdate(), and explicitly report errors via ERROR() when post-update actions or IPC fail. Signed-off-by: Arturs Laizans Signed-off-by: Arturs Laizans Signed-off-by: Arturs Laizans --- core/install_from_file.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/core/install_from_file.c b/core/install_from_file.c index e222e30e..719f613e 100644 --- a/core/install_from_file.c +++ b/core/install_from_file.c @@ -58,8 +58,26 @@ static int endupdate(RECOVERY_STATUS status) if (status == SUCCESS) { ipc_message msg; - msg.data.procmsg.len = 0; - if (ipc_postupdate(&msg) != 0 || msg.type != ACK) { + int ret = -1; + int retries = 3; + + while (retries > 0) { + memset(&msg, 0, sizeof(msg)); + msg.data.procmsg.len = 0; + ret = ipc_postupdate(&msg); + if (ret == 0) + break; + retries--; + if (retries > 0) + sleep(1); + } + + if (ret != 0) { + ERROR("Post-update actions failed: IPC communication error"); + end_status = EXIT_FAILURE; + } else if (msg.type != ACK) { + ERROR("Post-update actions failed: %s", + msg.data.msg[0] ? msg.data.msg : "rejected by server"); end_status = EXIT_FAILURE; } }