-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Close resources left by go-git after request is finished #8915
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
Conversation
…ctions that touch the repository directory Especially Windows doesn't like it when there are open handles when a directory is moved or copied.
db6e90a
to
197a1cf
Compare
@zeripath Sorry, I didn't know you also opened a pull request. I hope did not offend you. |
No problem. Could you take a look at #8901 and see if you think that covers how you think it should be done? Given the git.Repository isn't actually stateless we're probably gonna have to stop opening and re-opening it willy-nilly and instead consider passing it functions that need it. Either that or, we need to consider opening only at the template level for things that need it. |
I'd consider making opening the repository a lazy function. Then it would run on demand instead of every time. Or go-git could be modified (if technically possible) to have read-only mode that opens handles in a fashion that does not offend Windows on a directory move/replace. |
@Sebazzz And if you want to continue your pull request, you should send it to master at first and then send back port to v1.10 / v1.9 after that merged. |
Isn't this considered a bug fix? I actually based this in 1.9 because of the first point made in the pull request template. |
@Sebazzz This is a bug will affect v1.11 / v1.10 / v1.9 . Our habit is to send to v1.11(master) at first. |
Rebased onto master via #8916. |
I believe this a bugfix so I based this on the branch for hopefully a release in 1.9.6. It is a relatively small change but does prevent some resource leaks from happening. If this is not desired I'Il rebase on another branch.
In #7947 I figured out that go-git leaves handles to the pack files open. These are eventually garbage collected, but this isn't very deterministic.
What I did: