public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Allison Henderson <achender@kernel.org>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, pabeni@redhat.com, edumazet@google.com,
	 horms@kernel.org, linux-rdma@vger.kernel.org,
	linux-kselftest@vger.kernel.org,  shuah@kernel.org
Subject: Re: [PATCH net-next v2 6/7] selftests: rds: Collect pcaps on timeout
Date: Fri, 01 May 2026 22:41:09 -0700	[thread overview]
Message-ID: <9958903b1de52cff6d0d5531355da614cb66517e.camel@kernel.org> (raw)
In-Reply-To: <20260430024207.2452372-1-kuba@kernel.org>

On Wed, 2026-04-29 at 19:42 -0700, Jakub Kicinski wrote:
> This is an AI-generated review of your patch. The human sending this
> email has considered the AI review valid, or at least plausible.
> ---
> selftests: rds: Collect pcaps on timeout
> 
> This commit updates the RDS selftest to collect network packet captures
> when a timeout occurs. It moves the packet capture cleanup logic into a
> new helper function and calls it from the signal handler before exiting.
> 
> > diff --git a/tools/testing/selftests/net/rds/test.py b/tools/testing/selftests/net/rds/test.py
> > --- a/tools/testing/selftests/net/rds/test.py
> > +++ b/tools/testing/selftests/net/rds/test.py
> [ ... ]
> > @@ -70,11 +70,21 @@ def netns_socket(netns, *sock_args):
> >      u1.close()
> >      return socket.fromfd(fds[0], *sock_args)
> >  
> > +def collect_pcaps():
> > +    """Stop tcpdump processes and move their pcaps into the log dir."""
> > +    print("Stopping network packet captures")
> > +    for proc, tmp_path, dest_path, fno in tcpdump_procs:
> > +        proc.terminate()
> > +        proc.wait()
> 
> Could this proc.wait() block indefinitely and defeat the test timeout?
> 
> If a child process is unresponsive, the timeout signal handler will get
> stuck waiting for it. Using proc.wait(timeout=...) might ensure the
> timeout path remains robust and doesn't hang the test infrastructure.
Good catch, I will add a timeout

> 
> > +        os.close(fno)
> > +        shutil.move(tmp_path, dest_path)
> 
> Can this cause unhandled exceptions if the timeout triggers during or
> after the normal script cleanup phase?
> 
> Because collect_pcaps() is called from both the normal execution path and
> the timeout signal handler, it might be executed twice. Since it loops
> over the global tcpdump_procs list without clearing processed items, a
> second run will attempt to close already closed file descriptors and move
> already moved files.
> 
> In Python, this raises OSError (EBADF) and FileNotFoundError, which would
> abort the signal handler with a traceback instead of executing the clean
> sys.exit(1).
I see, I think if we change the for loop to a while loop that pop() items out of tcpdump_procs, that should make it safe
to call twice, if the timeout fires during or after normal cleanup.


If that sounds good, I can send that in a v3.

Thanks!
Allison



  reply	other threads:[~2026-05-02  5:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 22:27 [PATCH net-next v2 0/7] selftests: rds: Log collection, TAP compliance and cleanups Allison Henderson
2026-04-28 22:27 ` [PATCH net-next v2 1/7] selftests: rds: Increase selftest timeout Allison Henderson
2026-04-28 22:27 ` [PATCH net-next v2 2/7] selftests: rds: Update USAGE string for run.sh Allison Henderson
2026-04-28 22:27 ` [PATCH net-next v2 3/7] selftests: rds: Fix more pylint errors Allison Henderson
2026-04-28 22:27 ` [PATCH net-next v2 4/7] selftests: rds: Add timeout flag to run.sh Allison Henderson
2026-04-28 22:27 ` [PATCH net-next v2 5/7] selftests: rds: Fix gcov and pcap collection Allison Henderson
2026-04-30  2:42   ` Jakub Kicinski
2026-04-30  2:48     ` Jakub Kicinski
2026-05-02  5:43       ` Allison Henderson
2026-05-02 16:38         ` Jakub Kicinski
2026-05-03 20:49           ` Allison Henderson
2026-04-28 22:27 ` [PATCH net-next v2 6/7] selftests: rds: Collect pcaps on timeout Allison Henderson
2026-04-30  2:42   ` Jakub Kicinski
2026-05-02  5:41     ` Allison Henderson [this message]
2026-04-28 22:27 ` [PATCH net-next v2 7/7] selftests: rds: Make rds selftests TAP compliant Allison Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9958903b1de52cff6d0d5531355da614cb66517e.camel@kernel.org \
    --to=achender@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox