Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seems hard to believe, but do multiple test cases share files? #98372

Closed
smontanaro opened this issue Oct 17, 2022 · 5 comments
Closed

Seems hard to believe, but do multiple test cases share files? #98372

smontanaro opened this issue Oct 17, 2022 · 5 comments
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@smontanaro
Copy link
Contributor

Bug report

I got a failure on a pull request with this error message on the Windows x64 job:

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'D:\\a\\cpython\\cpython\\build\\test_python_4912�\\test_python_worker_4268�'

I know Windows will complain if two processes try to open the same file, but should different test cases even be using the same (temporary?) files? If they are, you'd think eventually test runs on other platforms would experience problems (stomping on each others' private data, for instance).

Unfortunately, I went back only to find GitHub had elided most of the steps, including that one.

Your environment

GitHub standard CI environment

@smontanaro smontanaro added the type-bug An unexpected behavior, bug, or error label Oct 17, 2022
@eryksun
Copy link
Contributor

eryksun commented Oct 17, 2022

See issue #98219.

I know Windows will complain if two processes try to open the same file

It's not inherently related to processes. A filesystem manages a share-access record for each open file or directory, which tracks the number of current opens that have read, write, or delete access, as well as the number of current opens that share read, write, and delete access. The tracking is only per open file object in the kernel. Access sharing is updated and checked whenever a file or directory is opened. It has nothing inherently to do with processes, despite the misleading error message for ERROR_SHARING_VIOLATION (32). On the other hand, a file lock (i.e. a read/write lock of a byte range in a file) is associated with a process. The error code for a locking violation is ERROR_LOCKING_VIOLATION (33). A locking violation can occur even if an open has the requisite read or write access since byte-range locks are enforced at the time of access, not at the time a file is opened.

@arhadthedev
Copy link
Member

arhadthedev commented Oct 18, 2022

The bug is currently investigated and fixed for Windows 11 in gh-97641. It looks like the fix will remedy the GitHub Actions too.

@erlend-aasland
Copy link
Contributor

The bug is currently investigated and fixed for Windows 11 in gh-97641. It looks like the fix will remedy the GitHub Actions too.

Which fix? Is there a PR?

@erlend-aasland
Copy link
Contributor

Is there an actionable item here? This issue has been stale since Oct 2022; suggesting to close it.

@erlend-aasland erlend-aasland added the pending The issue will be closed if no feedback is provided label Jan 15, 2024
@smontanaro
Copy link
Contributor Author

Wouldn't appear so. Close it...

@erlend-aasland erlend-aasland closed this as not planned Won't fix, can't repro, duplicate, stale Jan 15, 2024
@erlend-aasland erlend-aasland removed the pending The issue will be closed if no feedback is provided label Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

5 participants