-
Notifications
You must be signed in to change notification settings - Fork 27
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
Possible leak in double-booking cursor #31
Comments
Possible fixing gitpython-developers#31 double mmap increment, stop decrement on destruction, rely on with... resources.
Possible fixing gitpython-developers#31 double mmap increment, stop decrement on destruction, rely on with... resources.
Possible fixing gitpython-developers#31 by stop decrement on destruction, rely only on `with...` resources.
+ Possible fixing gitpython-developers#31 by stop decrement on destruction, rely only on `with...` resources. + feat(mmap): utility to check if regions have been closed (PY3-only).
OK, false alarm. On Windows, this is necessary before renaming/deleting git-repo, since if any (mmap) files open to some index/pack objects forbid these objects to move/delete. I have done some minor refactorings (bba086a) and style changes to go along with leak-job done in gitdb, plus one assertion method to check if there are any regions with closed undelying mmaps (works only for PY3). |
@Byron I'm reopening this to ask whether this behavior (of keeping always one ref to a region) was on purpose? I mean, now with I have retrofitted gitdb to use contextmanagers for streams and packers, and it works - all regions are de-registered in the end. But mmaps (and underlying files) are not closed automatically, and i have to invoke
Do you have any view on that? |
@ankostis Real quick (at lunch break): unfortunately I wrote it so long ago, that I have no idea about my intentions anymore. I just know that the entire ref-counting business was a mess, and at some point I just wanted to make it work while getting the impression it is still correct. |
By the way, I am super happy to see you are paving your way through the entire codebase, and I am extremely grateful for that (knowing that it must be very frustrating and all). |
@Byron you should have warned me that since GitPython#307, smmap is not used at all - all db-access is routed solely through |
I am very sorry you feel that way, as I had no intention to misinform you.
|
No, no pun intended. But I will write down some conclusions, for my efforts not to go in vain:
|
Reading all this it dawns on me that not using ContextManagers everywhere was the worst mistake that GitPython suffers from to date. It's all based on my initial observations that Add the split-personality of the Python ecosystem (py2 vs py3), and one ends up in a situation where python isn't really supposed to be used for anything that doesn't yet have the massively matured and proven implementation one might need to solve the problem at hand. It really aches me to see all this time invested just to finally have to succumb to the overall brokenness of the system. Certainly there is a fix for everything, but a rewrite might be easier after all. |
Probably 70fae1f made a double acounting of region-clients in
smmap.mman.py#L136
, where a "manual"increment_client_count()
follows a_obtain_region()
which it also increments the client-count.From gitdb TC
gitdb.test.test_pack:TestPack.test_pack_entity()
I can see that this is indeed the case, where it is increased 2 x 3 times for 3 mmaps, while it is decremented just 3 times.The text was updated successfully, but these errors were encountered: