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

astropy.log: The process cannot access the file because it is being used by another process #507

Merged
merged 1 commit into from
Apr 2, 2013

Conversation

embray
Copy link
Member

@embray embray commented Apr 2, 2013

c:\windows\temp\tmpyzcvmqastropy_config\astropy\astropy.log: The process cannot access the file because it is being used by another process

This is an error I get sometimes when the tests are run in Windows on Jenkins. Right now this is only happening in my staging branch where I'm testing #495, though I'd like to merge that work.

It always happens at the exact same point in the tests. To give a little further context:

astropy\io\fits\tests\test_image.py:883: TestImageFunctions.test_scale_back PASSED
astropy\io\fits\tests\test_image.py:907: TestImageFunctions.test_scale_back_compressed PASSED
astropy\io\fits\tests\test_image.py:948: TestImageFunctions.test_insufficient_compression_allocation error: c:\windows\temp\tmpyzcvmqastropy_config\astropy\astropy.log: The process cannot access the file because it is being used by another process

E:\Builds\astropy-winxp32-staging-iguananaut\workspaces\COMPILER\mingw32\NUMPY_VER\numpy-1.5.1\PYTHON_VER\python-2.7>exit 1 

It seems like the test runner itself is crashing, because the tests just stop there. The test it's stopping at is a slightly bizarre one, but it doesn't do anything I can think of that would affect the log, so I'm not convinced the test itself is relevant (though I might try disabling it). This occurs on some test configurations but not others, though I haven't discerned any pattern so I think it's more or less non-deterministic. When I run the tests manually in the same configuration it does not occur, so it seems like it might be due to an interaction with Jenkins.

Any hypotheses?

@embray
Copy link
Member Author

embray commented Nov 27, 2012

Hrm...disabling that one test did seem to go better, though the full build still didn't succeed due to github timing out on some of the later configurations. But until that happened all the previous configurations succeeded. Giving it one more try.

@eteq
Copy link
Member

eteq commented Nov 27, 2012

What I don't understand is why it should care at all that another file object is using it. There isn't supposed to be any locking or anything. So why doesn't it just append to the file with no concern that another object is using it?

@embray
Copy link
Member Author

embray commented Dec 4, 2012

Well I found that the test it's occurring on maybe does have something to do with it--when I disable that test I don't see this error. It's still very odd though.

@eteq
Copy link
Member

eteq commented Dec 5, 2012

Definitely very odd. I guess the workaround is to skip that one test if you're on windows? If it appears somewhere else later perhaps it requires more investigation...

@ghost ghost assigned embray Dec 5, 2012
@embray
Copy link
Member Author

embray commented Dec 5, 2012

I'll go ahead and assign myself to this so that it doesn't get lost, and I'll just disable that test on Windows so I can move forward on merging #495. I still want to figure out what's going on here at some point though.

embray added a commit to embray/astropy that referenced this pull request Dec 5, 2012
…m that it *does* pass when the test suite is run outside of Jenkins, even on the configurations where it was failing.
@mnot mnot mentioned this pull request Jan 25, 2013
@embray
Copy link
Member Author

embray commented Apr 1, 2013

I'm getting this error now in a different test that was included in 3e0fe42.

I'm not sure the error is directly related to the logging, because if I disable all logging to files all that happens is the process exits without reporting anything. It's more like it's segfaulting.

…hack I was using before, and refactors so that when compressing an image, the compression module handles creation of the new Numpy array, and only once CFITSIO is complete and we know how large the compressed data buffer is going to be. Then compress_hdu() returns the new Numpy array along with the heapsize. This is a lot less spaghetti-ish than the previous code, and somewhat simpler overall. Removed the test_insufficient_compression_allocation test since it no longer works correctly with the new code. But that's okay--the test_lossless_gzip_compression test tests this case for us implicitly, which is why it was failing on Windows in the same way. This is because the way CFITSIO estimates how much space it will need for the compressed data, it always ends up being less than what's needed for lossless compression.
@embray
Copy link
Member Author

embray commented Apr 2, 2013

The attached PR fixes the issue as originally reported, and fixes a new issue that cropped up in 3e0fe42 which had the same symptoms and turns out to be caused by the same thing.

In short, my hacked around fake realloc was causing an access violation on Windows, though not usually on Linux. This refactors the compress_hdu() function so that such a hack is not necessary.

@embray
Copy link
Member Author

embray commented Apr 2, 2013

Assuming the tests for this pass on Travis, I need to merge this soon as it's causing the tests to fail on Windows.

@eteq
Copy link
Member

eteq commented Apr 2, 2013

Seems fine to me, but why did you delete the test for it? Or is that using some of the code you deleted (I didn't see where, but I admit I'm not fully understanding this)

@embray
Copy link
Member Author

embray commented Apr 2, 2013

@eteq As explained in the commit message, the test that was deleted no longer makes sense with the way the code was reorganized, but there's a different test that tests the same corner case implicitly (it's a difficult case to force explicitly which is what the old test did).

embray added a commit that referenced this pull request Apr 2, 2013
astropy.log: The process cannot access the file because it is being used by another process
@embray embray merged commit 3cc0779 into astropy:master Apr 2, 2013
@embray embray deleted the issue-507 branch April 2, 2013 14:25
embray added a commit to embray/astropy that referenced this pull request Apr 2, 2013
… a handle to test.fits is kept open by the mmap. I suppose this could also use memmap=False. I thought I had included this commit before I merged the original PR for astropy#507 but apparently I did not.
@embray embray mentioned this pull request Apr 2, 2013
embray added a commit that referenced this pull request Apr 2, 2013
embray added a commit that referenced this pull request Apr 2, 2013
embray added a commit that referenced this pull request Apr 2, 2013
astropy.log: The process cannot access the file because it is being used by another process
embray added a commit that referenced this pull request Apr 2, 2013
embray added a commit that referenced this pull request Apr 2, 2013
keflavich pushed a commit to keflavich/astropy that referenced this pull request Oct 9, 2013
…m that it *does* pass when the test suite is run outside of Jenkins, even on the configurations where it was failing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants