Skip to content

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

Description

@benthayer

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 git@github.com: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.

Activity

  1. Byron commented on Oct 15, 2019

    @Byron
    Member

    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.

  2. benthayer commented on Oct 22, 2019

    @benthayer
    ContributorAuthor

    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.

  3. Byron commented on Oct 23, 2019

    @Byron
    Member

    @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 :)!

  4. benthayer commented on Oct 23, 2019

    @benthayer
    ContributorAuthor

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

  5. added this to the v3.0.5 - Bugfixes milestone on Oct 24, 2019
  6. Byron commented on Oct 24, 2019

    @Byron
    Member

    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.

  7. benthayer commented on Oct 24, 2019

    @benthayer
    ContributorAuthor

    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

  8. benthayer commented on Nov 13, 2019

    @benthayer
    ContributorAuthor

    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?

  9. Byron commented on Nov 14, 2019

    @Byron
    Member

    @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.

  10. benthayer commented on Nov 14, 2019

    @benthayer
    ContributorAuthor

    @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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions