Skip to content

Git.AutoInterrupt.__del__() OSError: [WinError 6] The handle is invalid #935

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

Closed
benthayer opened this issue Oct 10, 2019 · 9 comments · Fixed by #949
Closed

Git.AutoInterrupt.__del__() OSError: [WinError 6] The handle is invalid #935

benthayer opened this issue Oct 10, 2019 · 9 comments · Fixed by #949

Comments

@benthayer
Copy link
Contributor

benthayer commented Oct 10, 2019

I'm getting this error on the multiple windows machines I've tested this on. I'm working on an open source project, so it should be relatively easy to reproduce although I'm not sure on how easy it'd be to fix.

I'm using Python 3.7.4

Link to my repo: https://github.com/bthayer2365/git-gud

Here is the full error:

Setting up challenge: "intro commits"
Setup complete
Type "git gud instructions" to view instructions
Executed successfully
Exception ignored in: <function Git.AutoInterrupt.__del__ at 0x0000015DE3031798>
Traceback (most recent call last):
  File "c:\Users\benth\Miniconda3\envs\git-gud\lib\site-packages\git\cmd.py", line 365, in __del__
    if proc.poll() is not None:
  File "c:\Users\benth\Miniconda3\envs\git-gud\lib\subprocess.py", line 966, in poll
    return self._internal_poll()
  File "c:\Users\benth\Miniconda3\envs\git-gud\lib\subprocess.py", line 1216, in _internal_poll
    if _WaitForSingleObject(self._handle, 0) == _WAIT_OBJECT_0:
OSError: [WinError 6] The handle is invalid
Exception ignored in: <function Git.AutoInterrupt.__del__ at 0x0000015DE3031798>
Traceback (most recent call last):
  File "c:\Users\benth\Miniconda3\envs\git-gud\lib\site-packages\git\cmd.py", line 365, in __del__
    if proc.poll() is not None:
  File "c:\Users\benth\Miniconda3\envs\git-gud\lib\subprocess.py", line 966, in poll
    return self._internal_poll()
  File "c:\Users\benth\Miniconda3\envs\git-gud\lib\subprocess.py", line 1216, in _internal_poll
    if _WaitForSingleObject(self._handle, 0) == _WAIT_OBJECT_0:
OSError: [WinError 6] The handle is invalid

How to reproduce:

git clone [email protected]:bthayer2365/git-gud.git  # or fork it!
cd git-gud
git checkout 4fe87dcdc56fe7cee8924663bef694b8e6c8ecc2
pip install -e .
cd ..
mkdir test
cd test
python -m gitgud start # Error occurs here
git gud load intro # Error occurs here

python -m gitgud start calls the same function that git gud load intro does.

@Byron
Copy link
Member

Byron commented Oct 15, 2019

Thanks for posting, and for making it easy to reproduce for those with access to a windows machine.

Personally I am not among them, but hope that those with a similar issue can chime in to help get this resolved.

@benthayer
Copy link
Contributor Author

I'm working on this. It seems that the easy fix is to just wrap proc.poll() in a try/except. I'm not sure if that's what you'd want. The harder part is adding a test. My situation seems to be particular and testing for the issue might be complicated. If you're okay with it, I'd like to submit a PR with this simple solution and no test.

Here are links to the diffs:
master...bthayer2365:WinError6
master...bthayer2365:WinError6_test

The WinError6 branch solves the problem, but the WinError6_test branch is very much incomplete.

@Byron
Copy link
Member

Byron commented Oct 23, 2019

@bthayer2365 Thanks for posting the fix, and I absolutely agree that in this case, a test will be difficult to produce given the specificity of the issue. The log will help to get some sort of hint why it is what it is, in case it poses problems to some in future.
Thanks a lot for contributing :)!

@benthayer
Copy link
Contributor Author

Great, glad we're on the same page! Thanks for merging. May I ask when I can expect to see this in a release?

@Byron Byron added this to the v3.0.5 - Bugfixes milestone Oct 24, 2019
@Byron
Copy link
Member

Byron commented Oct 24, 2019

v3.0.4 was released yesterday, and I would collect a few more fixes before releasing v3.0.5. If things are pressing on your end, please let me know and I can certainly v3.0.5 early.

@benthayer
Copy link
Contributor Author

Nothing too pressing for me, everything works, just get that ugly-looking error message every time. Many users will have no idea about the issue anyways, but it'll be fixed as soon as you release this fix, and then I'll just add the requirement that GitPython be >= v3.0.5

@benthayer
Copy link
Contributor Author

Hi @Byron I'm at the point where I want to start advertising Git Gud to more people. It would be great if this bug was fixed when people installed it. Could you push v3.0.5?

@Byron
Copy link
Member

Byron commented Nov 14, 2019

@bthayer2365 Thanks for the nudge :) - it's done, and v3.0.5 was just released to PyPi. The best of success!

When ready, feel free to add Git Gud to the list of projects that use GitPython in this repository's README file.

@benthayer
Copy link
Contributor Author

@Byron thank you! You already merged the PR with my project, so we should be good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants