DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: Andre Muezerie <andremue@linux.microsoft.com>
Cc: dev@dpdk.org
Subject: Re: [PATCH 1/1] buildtools: avoid break due to failure to cleanup temporary directory
Date: Tue, 6 May 2025 01:47:03 +0300	[thread overview]
Message-ID: <34050120-4370-4cbb-aeb2-c6956896cde6@gmail.com> (raw)
In-Reply-To: <1746474405-5056-2-git-send-email-andremue@linux.microsoft.com>

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


  parent reply	other threads:[~2025-05-05 22:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-05 19:46 [PATCH 0/1] " Andre Muezerie
2025-05-05 19:46 ` [PATCH 1/1] buildtools: " Andre Muezerie
2025-05-05 20:09   ` Andre Muezerie
2025-05-05 22:47   ` Dmitry Kozlyuk [this message]
2025-05-06 22:12     ` Andre Muezerie
2025-05-06 22:14 ` [PATCH v2 0/1] " Andre Muezerie
2025-05-06 22:14   ` [PATCH v2 1/1] buildtools: " Andre Muezerie
2025-05-06 22:31     ` Dmitry Kozlyuk
2025-05-07 14:21 ` [PATCH v3 0/1] " Andre Muezerie
2025-05-07 14:21   ` [PATCH v3 1/1] buildtools: " Andre Muezerie
2025-05-07 15:32     ` Dmitry Kozlyuk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=34050120-4370-4cbb-aeb2-c6956896cde6@gmail.com \
    --to=dmitry.kozliuk@gmail.com \
    --cc=andremue@linux.microsoft.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).