All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Dave Chinner <david@fromorbit.com>
Cc: fstests <fstests@vger.kernel.org>
Subject: Re: [PATCH 1/8] generic/038: kill background threads on interrupt
Date: Tue, 24 May 2022 15:30:18 +0300	[thread overview]
Message-ID: <CAOQ4uxj1YptwkBRXhpsX6cCc2QSazZo9H=-HGjznCVjt0Ct76w@mail.gmail.com> (raw)
In-Reply-To: <20220524121001.GK2306852@dread.disaster.area>

On Tue, May 24, 2022 at 3:10 PM Dave Chinner <david@fromorbit.com> wrote:
>
> On Tue, May 24, 2022 at 12:41:25PM +0300, Amir Goldstein wrote:
> > On Tue, May 24, 2022 at 12:12 PM Dave Chinner <david@fromorbit.com> wrote:
> > >
> > > From: Dave Chinner <dchinner@redhat.com>
> > >
> > > When I ctrl-c g/038, it either does nothing or it leaves processes
> > > running in the background. It is not cleaning up it's background
> > > processes correctly, so add kill vectors into the cleanup. Make sure
> > > we only kill in the cleanup trap if the background processes are
> > > running.
> > >
> > > Signed-off-by: Dave Chinner <dchinner@redhat.com>
> > > ---
> > >  tests/generic/038 | 16 ++++++++++------
> > >  1 file changed, 10 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/tests/generic/038 b/tests/generic/038
> > > index c6cea94e..0462ea13 100755
> > > --- a/tests/generic/038
> > > +++ b/tests/generic/038
> > > @@ -36,6 +36,10 @@ _begin_fstest auto stress trim
> > >  # Override the default cleanup function.
> > >  _cleanup()
> > >  {
> > > +       [ -n "${create_pids}" ] && kill ${create_pids[@]}
> > > +       [ -n "${fallocate_pids}" ] && kill ${fallocate_pids[@]}
> > > +       [ -n "${trim_pids}" ] && kill ${trim_pids[@]}
> > > +       wait
> >
> > Following the pattern of recently fixed generic/019,
> > Please redirect stderr of kill to /dev/null
>
> No. Redirecting errors to /dev/null to hide them is poor behaviour
> - g/019 does not test if the pids variables are still valid even
> though they get unset. Hence the normal exit trap
> runs an empty `kill` command which outputs a help message. The
> redirect to /dev/null hides this broken behaviour - it's poor,
> buggy code, and an example how buggy and broken a lot of the cleanup
> code actually is.
>
> The code above will not run kill with an empty pid list, hence it
> should not fail when it is run. If it does fail then we've got a
> problem that needs to be captured and analysed and so redirecting
> that error to /dev/null is exactly the wrong thing to be doing.
>
> > and I think we would rather not wait in cleanup callbacks
> > which could potentially block forever?
>
> We do that in many, many tests - that's how we stop the test leaving

Yes, I've seen that.

> background processes running after the test exits. And if it hangs
> here waiting on a hung process, then as a developer using this to
> find bugs in my code, I really do want the test to hang hard so I
> notice it and can capture the failure and analyse it.

Makes sense to me, but I think the practice for cleanup should be
(like in fsstress_cleanup) to send SIGKILL and wait in case
the processes are ignoring or already handling SIGTERM.

>
> Leaving a warm corpse to post-morten is the desired behaviour of a
> failed test.
>
> > >         rm -fr $tmp
> >
> > I suppose another patch is going to replace that with the proper _cleanup()?
> > Patches from vger have been VERY slowly trickling into my mailbox.
>
> Not in this patch series. When I tackle the generic tests I'll
> address these bugs. This patch is just fixing broken ctrl-c
> behaviour.
>

Great.
So w.r.t this patch there are only minor comments of kill -9
and move unset of create_pids.
Take it or leave it, either way you may add:

Reviewed-by: Amir Goldstein <amir73il@gmail.com>

Thanks,
Amir.

  reply	other threads:[~2022-05-24 12:30 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-24  7:34 [RFC PATCH 0/8] fstests: _cleanup() overrides are a mess Dave Chinner
2022-05-24  7:34 ` [PATCH 1/8] generic/038: kill background threads on interrupt Dave Chinner
2022-05-24  9:41   ` Amir Goldstein
2022-05-24 12:10     ` Dave Chinner
2022-05-24 12:30       ` Amir Goldstein [this message]
2022-05-24  7:34 ` [PATCH 2/8] fstests: _cleanup overrides are messy Dave Chinner
2022-05-24 16:16   ` Amir Goldstein
2022-05-24  7:34 ` [PATCH 3/8] xfs/*: clean up _cleanup override Dave Chinner
2022-05-24 10:42   ` Amir Goldstein
2022-05-24 12:27     ` Dave Chinner
2022-05-24 12:55       ` Amir Goldstein
2022-05-24 13:24         ` Dave Chinner
2022-05-24 14:17           ` Amir Goldstein
2022-05-24 16:32             ` Zorro Lang
2022-05-24 23:34             ` Dave Chinner
2022-05-25  2:54               ` Amir Goldstein
2022-05-24 17:13     ` Zorro Lang
2022-05-26 15:04       ` Zorro Lang
2022-05-26 23:39         ` Dave Chinner
2022-05-24  7:34 ` [PATCH 4/8] fstests: define a common _dump_cleanup function Dave Chinner
2022-05-24  9:04   ` Amir Goldstein
2022-05-24  9:52     ` Dave Chinner
2022-05-24  9:59       ` Amir Goldstein
2022-05-24  7:34 ` [PATCH 5/8] fstests: use a common fsstress cleanup function Dave Chinner
2022-05-24 12:25   ` Amir Goldstein
2022-05-24  7:34 ` [PATCH 6/8] fstests: consolidate no cleanup test setup Dave Chinner
2022-05-24 12:22   ` Amir Goldstein
2022-05-24 13:07     ` Dave Chinner
2022-05-24  7:34 ` [PATCH 7/8] fstests: Set up BUS trap for tests by default Dave Chinner
2022-05-24  8:48   ` Amir Goldstein
2022-05-24  7:34 ` [PATCH 8/8] fstests: cleanup _cleanup usage in shared Dave Chinner
2022-05-24 10:49   ` Amir Goldstein
2022-05-24 11:11   ` Amir Goldstein
2022-05-24  8:29 ` [RFC PATCH 0/8] fstests: _cleanup() overrides are a mess Amir Goldstein
2022-05-24  9:57   ` Dave Chinner
2022-05-24 10:01     ` Amir Goldstein
2022-05-24 10:13       ` Dave Chinner
2022-05-24 12:14         ` Amir Goldstein
2022-05-24 12:28           ` Dave Chinner
2022-05-24 12:34             ` Amir Goldstein

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='CAOQ4uxj1YptwkBRXhpsX6cCc2QSazZo9H=-HGjznCVjt0Ct76w@mail.gmail.com' \
    --to=amir73il@gmail.com \
    --cc=david@fromorbit.com \
    --cc=fstests@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.