From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796516591; b=lwwYpqnmyTkhJuAETt+oK05e4H+TAjBzR38BxQDMClXv5l1pHE1I3IU7E+rI6+FG04fw A49GOp7huFen4GYLYcoOA5Ld3OiVKkyP3/5LNoi4bG+3zCu0jHAjPvi39HLd8x0Hnn3x/ gIb5ycH16/e3lF6Y4a7nHkTLd4dtL6NHzLcnp7p5dks8t/rkJq3ld1HgrEkEs/WJTKPSU Ih5VDGEQU7ZO6bLXsdd+Tff1+8fCwH8obLF5yOFCenhFYKPSUk9kyjivr1yx55juixQly YPayPlLEcr8DA0iL6kaQesFkp0xKeXKFhXda4Y6xENrdshvcpF7LcJ3bVKpDpNClZow== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796516591; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=KSd+D5ypXkLIIl3p/C0G83/aHzTAye9NZJ/1oyKwaos=; b=mSRLc2rQb9wObNHvzF71a7avn/6lfFwYkzKAOl+OqASDHQR1SSEchhfZpgpDnf2QlACR Tbfy+NhT7Z3fJan6E+KlStaKZwoo3uIF8hrN8/Ya8XINlU9ejrYa630w9Wed/sxUfKzfN qV8lUO/AxIB42ADTPstTdh+37uRbGbGFNcrWzTq9D43UK7CIJIKprWadLh6OV37BnJe8l ndXaobxWzULgIBvabkeWSaHi1+C9Mw3K5Epi1WZg+9FV3RpJQYggp8UnJxfHImlavUe/Z eLIzUtRC+E/HETPVcv5YCsrOiuwlZa/izOGSIvz8XljN5BF8S9kSdReYnvwSEGPO86w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MSnfrVBW; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15A75606A333; Sun, 6 Dec 2026 00:23:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MSnfrVBW Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCE4F1F00A13; Sun, 6 Dec 2026 00:23:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796516590; bh=KSd+D5ypXkLIIl3p/C0G83/aHzTAye9NZJ/1oyKwaos=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=MSnfrVBW9lNQDwGK2th1Zb153m5bg90+HFX0oGzE6SxEsa0ILeQC2wj5z2ngp0aBC GNQefA84AefWuKa2eBp+xKIT+l9SbGj7hmordlbMHznRnijc/5/alj2lOndAwga8g/ PX4R9PyTZNsLk4BNRFoIWBszYiCRjLxa/PQnOU+Pd0SXJqa4B/yLGIR2v+g1CFH7/x RZhEIjqmQpOb4QjalcGK0qSxPhTYziqfFXvOYYtj9w/TA61MKbhGycCnR2WggMCJR3 13S7aMsQeOGR8f/Zt1o/2ukVpVoklBq7WQeNWzxvvrkdwNNOlJ3kpN3KWzh5R9uakT KDdD3Z/wwmHvA== Subject: Re: [PATCH net v3 6/9] selftests: net: py: add a timeout argument to bkg() From: netdev-bot+sashiko@kernel.org To: rjethwani@purestorage.com Cc: netdev@vger.kernel.org, stable@vger.kernel.org, john.fastabend@gmail.com, kuba@kernel.org, sd@queasysnail.net, davem@davemloft.net, edumazet@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org, alice.kernel@fastmail.im, tariqt@nvidia.com Date: Sun, 06 Dec 2026 00:23:09 +0000 Message-ID: <179651658944.3148.162921538728943469@kernel.org> In-Reply-To: <20261204235642.36653-7-rjethwani@purestorage.com> References: <20261204235642.36653-7-rjethwani@purestorage.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 0 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] bkg.__exit__() handles timeout=None differently on its two cancellation paths. -- selftests: net: py: add a timeout argument to bkg() This patch adds a timeout argument to bkg() so callers can override the 20-second context-exit timeout. A value of None waits indefinitely on normal exit, while a readiness-enabled command gets one second to exit on cancellation. > diff --git a/tools/testing/selftests/net/lib/py/utils.py b/tools/testing/selftests/net/lib/py/utils.py > index 9edfc4f88621c..1db7a21db6423 100644 > --- a/tools/testing/selftests/net/lib/py/utils.py > +++ b/tools/testing/selftests/net/lib/py/utils.py > @@ -274,7 +274,11 @@ class cmd: > if self.proc.poll() is None: > if terminate: > self._kill_group(signal.SIGTERM) > - self._drain_until_exit((out, err), timeout=timeout) > + # None waits forever elsewhere; cleanup must end. Not > + # "timeout or 1", which would change an explicit 0. > + self._drain_until_exit((out, err), > + timeout=1 if timeout is None > + else timeout) > self._collect_reaped(out, err) [ ... ] > @@ -410,15 +415,18 @@ class bkg(cmd): > terminate = terminate or (self._exit_wait and ex_type is not None) > if ex_type is None: > return self.process(terminate=terminate, fail=self.check_fail, > - expect_fail=self.expect_fail) > + expect_fail=self.expect_fail, > + timeout=self.timeout) > # Cancelled, e.g. by Ctrl-C: stop the command and what it started, > # without replacing the exception in flight. > if self._own_pgrp: > - self._cleanup_quietly(self._reap_cancelled, terminate, 20) > + self._cleanup_quietly(self._reap_cancelled, terminate, > + self.timeout) > else: > self._cleanup_quietly(self.process, terminate=terminate, > fail=self.check_fail, > - expect_fail=self.expect_fail) > + expect_fail=self.expect_fail, > + timeout=self.timeout) [Severity: Medium] Can cancellation cleanup hang here when bkg() is created with timeout=None? The new comment in cmd._reap_cancelled() says "cleanup must end", and that path maps None to a 1 second grace period. That only covers _own_pgrp commands, though. This else branch handles every remote (host=) command and every local command started without ksft_ready/ksft_wait. It passes self.timeout to process() unchanged, so None reaches cmd._process_terminate(): bkg.__exit__() _cleanup_quietly(self.process, ..., timeout=None) cmd.process() cmd._process_terminate() self.proc.terminate() stdout, stderr = self.proc.communicate(timeout=timeout) proc.terminate() only signals the leader. If the command ignores SIGTERM, or if it is a shell whose descendants keep stdout/stderr open, does communicate(timeout=None) ever return? _cleanup_quietly() only catches Exception, and nothing is raised in this case. A test assertion failure inside the with-block would then hang the runner while the exception unwinds, and no second Ctrl-C is coming to break out of it. Before this patch both cancellation paths were bounded at 20 seconds. The else branch got that from process()'s default timeout=20. Would it make sense to apply the same "1 if timeout is None else timeout" mapping in this branch, or to describe the difference in the commit message? The commit message currently only says: None waits indefinitely on normal exit, but gives a readiness-enabled command one second to exit on cancellation. > return None > > -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204235642.36653-1-rjethwani%40purestorage.com