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

Random Windows test failures on AppVeyor #896

Closed
embray opened this issue Sep 27, 2016 · 3 comments
Closed

Random Windows test failures on AppVeyor #896

embray opened this issue Sep 27, 2016 · 3 comments

Comments

@embray
Copy link
Contributor

embray commented Sep 27, 2016

Several of the AppVeyor test runs are randomly erroring out in get_test_subprocess with errors like:

======================================================================
ERROR: setUpClass (test_windows.WindowsSpecificTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\projects\psutil\psutil\tests\test_windows.py", line 68, in setUpClass
    cls.pid = get_test_subprocess().pid
  File "c:\projects\psutil\psutil\tests\__init__.py", line 209, in get_test_subprocess
    os.remove(TESTFN)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\projects\\psutil\\$testfile'

I'm just making this placeholder issues for it to say that I'm working on fixing this; will add a PR when I'm fairly confident it's fixed.

@giampaolo
Copy link
Owner

giampaolo commented Sep 27, 2016

Oh yeah. That's a race condition / timing issue.
We need to first safe_remove() the file before running the subprocess, then retry a bunch of times in case of error == 32.
A better alternative would be to use some other synchronization mechanism other than a file, like a signal, but I'm not sure whether that can be done on Windows as historically it implements signals very poorly.

@embray
Copy link
Contributor Author

embray commented Sep 27, 2016

Instead of safe_remove I'm using wait_for_file which I modified slightly to allow for this case as well.

@giampaolo
Copy link
Owner

I suppose this is fixed by now. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants