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:
     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