On Mon, May 05, 2025 at 12:46:45PM -0700, 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 <andre...@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:

This built fine on my machine but failed on the CI.

According to doc\guides\linux_gsg\sys_reqs.rst, currently the minimum
required Python version is 3.6.
However, parameter ignore_cleanup_errors parameter was added in 3.10
(https://docs.python.org/3/library/tempfile.html)

Is there something that blocks us from requiring 3.10 at minimum? Is this
something that could be done for the next release?

>      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)
> -- 
> 2.49.0.vfs.0.2

Reply via email to