Re: [PATCH] selftests/damon/sysfs.py: clean up sh processes used for obsolete_target test
From: SJ Park
Date: Tue Jul 21 2026 - 22:40:30 EST
Hello Hari,
On Tue, 21 Jul 2026 21:04:04 +0200 Hari Mishal <harimishal1@xxxxxxxxx> wrote:
> The obsolete_target test spawns three sh processes and uses their pids
> as DAMON monitoring targets. These processes are created without their
> own stdin, so they inherit the test program's stdin, and they are never
> waited on or told to exit. As a result, they are left running (or
> become zombies) as orphaned children after the test program exits.
Thank you for finding this problem and sharing this great patch!
>
> Give each sh process its own dedicated stdin pipe instead of inheriting
> the test program's, and after the targets are no longer needed,
> communicate() with each process to close its stdin. This sends EOF to
> the shell, which makes it exit, and communicate() then reaps the
> process.
Can't we use terminate() or kill() instead of communicate()?
Thanks,
SJ
[...]