-
-
Notifications
You must be signed in to change notification settings - Fork 919
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
Issues with AutoInterrupt in conjunction with sys.exit on python 3.5 #463
Comments
I recall from reading another isssue that the problem is that the process object is not being deleted Looking at the code it looks like the fix is to explicitly del the process object once it is no longer needed. This bug I suspect may happen on py2 depending on garbage collector config. for example from cmd.py:965:
should be something along these lines:
|
Which version of GitPython are you using ? It doesn't appear to be the latest one. |
Closed due to inactivity. Please comment to get the issue reopened. |
Byron, Unless you fixed the code this bug is still present in the code base. Barry |
@barry-scott Can you please answer the question in my last comment, or maybe even provide a test that triggers the issue to allow it to be fixed ? Otherwise this one would be open forever, and I try to avoid that. Thank you. |
And I just noticed that you have not been the OP, yet it seemed you have information about the issue that might help resolving it. |
What I recall is that I noticed is the with python2 as soon as the object owning a process resource goes out of scope its is deleted. But in python3 the delete is delayed because of changes in garbage collection. For example line 635 in cmd..py returns an instance of AutoInterrupt. All caller will have to be changed to del the returned object after use. Unless this code change has been made this bug remains unfixed. |
Thanks @barry-scott, I understand. It seems a context manager for the |
I'm pondering if the cmd code should be ripped out and replaced en-mass. We now know that it needs to:
I think that the above features for cmd can be implemented in a smaller and more obvious way (I wish you would setup a mailing list for GItPython to allow discussions) |
@barry-scott I believe you are right - the code has been growing just to accommodate all the needs as they arose. This will eventually erode clarity unless some major refactoring or even a rewrite is done. A good starting point would be to clearly separate the orthogonal parts. Something that comes to mind immediately is the part that streams objects through the git process (a hash goes in, an object comes out, the process is held alive permanently). Another obvious step could be to remove all reliance on the destructors and use context-managers or something like an idempotent On the bright side, one can stake small steps in this endeavour, knowing that the massive reliance on the implementation will show any issues right away when running the tests, some of which might have to be adjusted at some point. In any case, I find it most important to at most deprecate old parts of the API, so that existing clients have time to adjust. Ideally, they won't even have to, as many will just use it as a simple call wrapper. When reading through the list of bullet points, one seems to be new in particular: This project had a mailing list before, and I closed it just because there was nothing happening. By now I do prefer using issues on github for all public communication. If you wish to go ahead with certain refactorings or improvements, you could open an issue for them and discuss the details there. Even though the process is not well defined, we will figure something out as we go, there isn't too many people active on this project after all. I hope that will work for you, as your contributions are greatly appreciated. |
On windows git credentials wincred prompts using the terminal stdin/stdout. I am working on a prototype of the process control and filtering the work is in: Its currently code is python3 only and the windows version is not sane. The macos/linux version is showing promise. python3 git_cmd.py git status Barry
|
Thanks for the heads-up. Looking at the code, I didn't see the usage of |
GIT_ASKPASS is half a solution. I could write a stub that using a named pipe to ask the main GUI for the answers. But that means the GUI must implement the credential storage. I guess I can figure out what git-credentials-wincred.exe does and fake being it. |
I strongly believe |
Yes you are right the credentials are stored after askpass returns them. I should have this askpass stuff integrated into scm woekbench soon. Barry
|
@barry-scott you may take a fresh look at code after some major Windows issues have been resolved in #519 and remaining ones are marked for #525. |
@ankostis thanks for the heads up. I will test against trunk and check for regressions. |
I am closing this issue as it had no interaction for more than 3 months. Please feel free to comment in case you need it to be reopened. |
I am getting this error on apache with mod_wsgi on Redhat 7.2 with python 3.6 ... latest version of gitpython [Fri Jun 08 13:03:17.584493 2018] [wsgi:error] [pid 21167] [client 10.53.9.7:33473] 2018-06-08 13:03:17,584 - ProcessGit - INFO - push:[] #-> /usr/sbin/httpd -V |
@hobbitten123 Depending on your usecase, you might also be able to eventually use /~https://github.com/Byron/grit-rs , which I just declared the spiritual successor of |
Well, it happened to me too. Using python 3.7.3, gitpython 2.1.11, git 2.15.1.windows.1 on Windows10 and running everything from git bash GNU bash, version 4.4.12(1)-release (x86_64-pc-msys) The app has many checks for existing files and uses sys.exit('error message') if some checks fail. If everything goes well the app adds a list of files and commits them. Everything used to be smooth when there was only one file added and committed, but when I started having two files added and committed I got this error:
The part of the app causing the error is this one:
The original with only one file added and committed was:
After reading #718 I added a manual deletion of the repo git object and everything works smooth.
So as a workaround manually calling del() before calling exit(0) works. |
The destructor of the cmd class (actually AutoInterrupt) seems to throw some errors using python 3.5 on Arclinux:
It seems this error is triggered by a call to sys.exit(0) at the end of my script, since it doesn't appear if I comment it out.
However I couldn't reproduce this behavior with python 2.7, here sys.exit(0) seems to be working with the module correctly.
What I do is simply clone a repo, add some files commit and push them to a remote.
The text was updated successfully, but these errors were encountered: