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

Ensure file resources are released #326

Conversation

@vokimon
Copy link
Contributor

@vokimon vokimon commented Jul 26, 2015

SymbolicReference leaked file descriptor resources when iterating on refs. unittest module complained:

symbolic.py:153: ResourceWarning: unclosed file <_io.TextIOWrapper name='...../gitrepo/.git/packed-refs' mode='rt' encoding='UTF-8'>
symbolic.py:148: ResourceWarning: unclosed file <_io.TextIOWrapper name='....../gitrepo/.git/packed-refs' mode='rt' encoding='UTF-8'>

Byron added a commit that referenced this pull request Jul 27, 2015
…patch-1

Ensure file resources are released
@Byron Byron merged commit 7c96f58 into gitpython-developers:master Jul 27, 2015
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@Byron
Copy link
Member

@Byron Byron commented Jul 27, 2015

Thank you very much !

I am afraid there are many more issues of that kind buried in the code as I was wrongly assuming (back in the days) that an object destructor is deterministically called (such as in C++). This led to me failing to explicitly close files.

@Byron Byron added this to the v1.0.2 - Fixes milestone Jul 27, 2015
@vokimon
Copy link
Contributor Author

@vokimon vokimon commented Jul 27, 2015

what about starting with a grep for 'open'?

@Byron
Copy link
Member

@Byron Byron commented Jul 27, 2015

One will have to spread these efforts among GitDB and SMMap as well. Both should have mechanisms to release resources, but I doubt this works properly.

For now the best way to workaround these resource related issues is to use a GitCmdObjectDB, at least when working with non-ref/object data.

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

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.