Re: [PATCH] _EbuildFetcherProcess: Handle SIGTERM

Joey Pabalinas <[email protected]> Mon, 22 Jul 2024 20:40:47 -1000
Newsgroups gmane.linux.gentoo.portage.devel
Message-ID <6y36twswi335qgryjvw5zqryr7vpddw44q5ocuj5edvtfafich@hjbszz4omx2f>
--vo6dov43kzc6ojki
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Jul 22, 2024 at 09:40:48PM GMT, Zac Medico wrote:
> Fix _EbuildFetcherProcess to handle SIGTERM, so that FETCHCOMMAND
> processes will not be left running in the background:
>=20
> * Convert the fetch function to an async_fetch coroutine function
>   so that it can use asyncio.CancelledError handlers to terminate
>   running processes.
>=20
> * Use multiprocessing.active_children() to detect and terminate
>   any processes that asyncio.CancelledError handlers did not have
>   an opportunity to terminate because the exception arrived too
>   soon after fork/spawn.
>=20
> * Add unit test to verify that a child process is correctly
>   killed when EbuildFetcher is cancelled, with short timeout in
>   case it takes some time for the process to disappear.
>=20
> Bug: https://bugs.gentoo.org/936273
> Closes: https://github.com/gentoo/portage/pull/1361
> Signed-off-by: Zac Medico <[email protected]>

Looks good.

Reviewed-by: Joey Pabalinas <[email protected]>

--=20
Cheers,
Joey Pabalinas

--vo6dov43kzc6ojki
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEx6b1SGGPTKxTmPDYqoHu9CTxowIFAmafUG8ACgkQqoHu9CTx
owIekg/8DO5cZ6uxpFY4g6YEP5TYV8tcZuxxFRVDEunmN6axkrVL4/M/9jsvaOrX
X0YWdN8sR79rheVVTCBXgC5NS+cLTST1/rfkX9Kh4Xgm+IfWR692qc7DChkwaE9Z
GzWbWXe+MzsPQq1vW9KVHDdlmwddCIqKe6TfQA6EcDTlgpOmda2K4QX7X5fcNZBN
Gk6cgRTYC++w+bXvINUEfgPsHnKiU2dRLLwIC9d1IHbJ9+4+kaO3GIVKvIzVFgOn
dFyicRSOYSvS2Z7/Dh2m1kgIveaqQ7KNe9HyagieNQTQFs+futLoo4kmBbx3uA/v
v9YFb4RbCoUaVbqX1v73h9aeYXlq/xUMz9PgJPyaWTmBc2cPaTIVBghfNFDAe+sK
2G4Un1NWxYNdZLz8jOGvpdPRN8AAYhi2MPmXHpZ57mUUdrfpk4WpOU+PuA6iNUG1
xhwUHyFIBClPgbWoDglGNaUx/fBj+f3lCdDFa4o1PHZQnaFEOE/Jl5S7QEJ4dZJr
6CqYxQhsXos/vnWrZWDfmdDJ5zaitm6f7wWWr+vLZIhd1QLV1c9GdaxsLlL3/ISP
Ocyy+q0KllFeo26HtBr6/76csTZgmqNZfeYu+YyMB7NpgsZFKUEPmCv6krPftoqO
4DdNtY2xoN64BQMzFTLbK8ZnppSRQbn8APPyWdU5FdaUppJ3KbU=
=YPaM
-----END PGP SIGNATURE-----

--vo6dov43kzc6ojki--