Article View: linux.kernel.netdev
Article #27561Re: [PATCH net v3 6/9] selftests: net: py: add a timeout argument to bkg()
From: netdev-bot+sashiko
Date: Sun, 06 Dec 2026 00:23
Date: Sun, 06 Dec 2026 00:23
106 lines
12462 bytes
12462 bytes
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
Technical Details
Message-ID:
<179651658944.3148.162921538728943469@kernel.org>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378196-linux-kernel-netdev=dewy.ruReferences:
<20261204235642.36653-7-rjethwani@purestorage.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378196-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v3 6/9] selftests: net: py: add a timeout argument to bkg() Date: Sun, 06 Dec 2026 00:23:09 +0000 Organization: Usenet Network Message-ID: <179651658944.3148.162921538728943469@kernel.org> References: <20261204235642.36653-7-rjethwani@purestorage.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3150714"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:67a2rNgcEC0Was/YGTmNu7yMH5A= sha256:Z7P68Z+YD1uI7dEgf3/67AKIJi6gdHece0SPiB2d8ek= sha1:yvMHydtLqGTRfHskkyhcnTi34B8= sha256:NmxgIS/Bvp1jeforDhSRQ/lelG5l88gCQqpgrf4+AA0= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 25E35117F08; Sun, 6 Dec 2026 03:23:31 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.54 X-Spam-Status: No, score=-3.54 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kQAEvODJDrJb; Sun, 6 Dec 2026 03:23:28 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-378196-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 1254E117F05; Sun, 6 Dec 2026 03:23:19 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 206CA32829; Sun, 6 Dec 2026 00:23:12 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796516592; b=f1J80FgeVwDbkV06X5DgLb51mX8cmiGqXUHDcgO+dTJRtI6T75jqhKXxHECYqOFW3LjU n5vrCauNutKnPpmkT3WTWjr9SiS0P+GzXkbDXuHLyhz8i5rdB+LhKwCf8D5QuzuOQMQ2n uQRZyRGPCEtkuxF0CaOD8PrC52sh4n9y71yajwD1stEBmEC7FOpLlk7E+h3q6p+zx+dS7 xLeRlG8pasPcujBc9GzVq8V/pVmg58wTYzXKrUHCRz3G+acZtP9IBLw5OeF3XdtY1+ALW aVN2xbcevFTeD3t9srsZbSJCo8KHPjJevBCLwP7q79pZTyyO1VGYxvYLCBd1y+BGQAg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796516592; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=KSd+D5ypXkLIIl3p/C0G83/aHzTAye9NZJ/1oyKwaos=; b=a7SYEjuUFcxaG/gX0h1VVvWxU1PaakIPNFpwLt7EKi5bnGLUoLGMP+bNIT84I0Y4xxua emwMuXjUjEoq4gVzxZao4k9I9sgDBPFkc877ztjfFQYVBYPVRljg1Hh1L2tszLkeRR/Wt BFDi+iQMe4uQrs7IdlxwaHDzjuU9E7L0qQxhJEnJou4NqeOXNGSJzqSf2kVBPHefUSAzG vm+U6jbw8dMqrIh0arlM4SgysrPmAMqbSgMNxnpKsUZU3kSCu1/hiJFMN5A1B/78XMRdF 7CbhQ/+8vhMYt2n+MNA6pNEbO7eiu5XaVs8toi45gBnfULD6/P79hm6CeS7HaHcyEBw== X-ARC-Authentication-Results: i=2; 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=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EB2A4606A338; Sun, 6 Dec 2026 00:23:11 +0000 (UTC) X-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 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-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== X-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== X-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 X-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) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCE4F1F00A13; Sun, 6 Dec 2026 00:23:09 +0000 (UTC) X-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== X-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 X-In-Reply-To: <20261204235642.36653-7-rjethwani@purestorage.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-Received-Bytes: 12150