[PATCH 1/1] buildtools: avoid break due to failure to cleanup temporary directory
Dmitry Kozlyuk
dmitry.kozliuk at gmail.com
Tue May 6 00:47:03 CEST 2025
Hi Andre,
On 05.05.2025 22:46, Andre Muezerie wrote:
> When compiling drivers on Windows, instances have been seen where a
> temporary directory fails to get cleaned up due to
> ERROR_SHARING_VIOLATION (32).
>
> Code inspection did not reveal problems with the DPDK code and scripts,
> and this issue was only seen on Windows. Adding a 1 second sleep before
> cleaning up the temporary directory seems to be effective, but to
> guarantee that this break does not happen anymore, flag
> "ignore_cleanup_errors" is set to "True".
>
> Signed-off-by: Andre Muezerie <andremue at linux.microsoft.com>
> ---
> buildtools/gen-pmdinfo-cfile.py | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/buildtools/gen-pmdinfo-cfile.py b/buildtools/gen-pmdinfo-cfile.py
> index 5fbd51658a..2ddbdb9502 100644
> --- a/buildtools/gen-pmdinfo-cfile.py
> +++ b/buildtools/gen-pmdinfo-cfile.py
> @@ -6,9 +6,10 @@
> import subprocess
> import sys
> import tempfile
> +import time
>
> _, tmp_root, ar, archive, output, *pmdinfogen = sys.argv
> -with tempfile.TemporaryDirectory(dir=tmp_root) as temp:
> +with tempfile.TemporaryDirectory(dir=tmp_root, ignore_cleanup_errors=True) as temp:
> paths = []
> for name in subprocess.run([ar, "t", archive], stdout=subprocess.PIPE,
> check=True).stdout.decode().splitlines():
> @@ -19,3 +20,10 @@
> check=True, cwd=temp)
> paths.append(os.path.join(temp, name))
> subprocess.run(pmdinfogen + paths + [output], check=True)
> +
> + if os.name == "nt":
> + # Instances have been seen on Windows where the temporary directory fails to get cleaned
> + # up due to ERROR_SHARING_VIOLATION (32).
> + # The sleep below is a mitigation for that issue, while ignore_cleanup_errors=True avoids
> + # failures when the issue is hit despite the mitigation.
> + time.sleep(1)
Not fond of this timing hack at all.
Meson 0.51 (minimum requirement is 0.57) introduced |@PRIVATE_DIR@ for
custom_target() [1].
Can we use it to get rid of tempfile.TemporaryDirectory?
drivers/meson.build:
custom_target(command: [pmdinfo, '@PRIVATE_DIR@', ...], ...)
buildtools/gen-pmdinfo-cfile.py:
_, temp, ..., *pmdinfogen = sys.argv
for name in subprocess.run([ar, "t", ...):
...
subprocess.run([ar, "x", ...], cwd=temp)
...
|
|[1]: https://mesonbuild.com/Reference-manual_functions.html#custom_target
|
More information about the dev
mailing list