Skip to content
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

Error when downloading: Cancelling an overlapped future failed #1

Closed
johanhelsing opened this issue May 2, 2020 · 5 comments
Closed

Comments

@johanhelsing
Copy link
Contributor

Hi, this looks like exactly what I was going to write myself :)

I get this error when I try to download, though:

~/dev/assets/audio/music oga download winter
Cancelling an overlapped future failed
future: <_OverlappedFuture pending overlapped=<pending, 0x2013249dc10> cb=[_ProactorReadPipeTransport._loop_reading()]>
Traceback (most recent call last):
  File "c:\users\johan\appdata\local\programs\python\python38\lib\asyncio\windows_events.py", line 66, in _cancel_overlapped
    self._ov.cancel()
OSError: [WinError 6] The handle is invalid

On Windows with Python 3.8.2

@numberoverzero
Copy link
Owner

Thanks for opening an issue, and I'm sorry this isn't working for you. I'm just starting to look for assets on windows, and am especially motivated to fix this.

A quick search pulled up an issue in cpython 3.8.x but that should have been fixed before the 3.8.2 release. Probably not related but keeping it here for reference.


While I get this set up on windows, and I'm entirely guessing at this point, could you try the following?

  1. oga --max-conns=1 download winter
  2. oga describe winter (and if that fails, oga --max-conns=1 describe winter)

@numberoverzero
Copy link
Owner

Well, windows installation has improved since the 2.6 days. That was faster than I expected :)

It looks like the command is completing, and then the cleanup logic is probably trying to re-close the loop. For (1) above the asset was downloaded, and for (2) the description is printed above the stack trace. Some additional context:

>pip3.8 list
Package        Version
-------------- -------
aiohttp        3.6.2
async-timeout  3.0.1
attrs          19.3.0
beautifulsoup4 4.9.0
chardet        3.0.4
click          7.1.2
idna           2.9
multidict      4.7.5
oga            1.0.2
pip            20.1
setuptools     41.2.0
soupsieve      2.0
wheel          0.34.2
yarl           1.4.2
oga --max-conns=1 describe winter
winter music (2 favorites, 5 tags)
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x03913E80>
Traceback (most recent call last):
  File "...\python38-32\lib\asyncio\proactor_events.py", line 116, in __del__
    self.close()
  File "...\python38-32\lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "...\python38-32\lib\asyncio\base_events.py", line 719, in call_soon
    self._check_closed()
  File "...\python38-32\lib\asyncio\base_events.py", line 508, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

You should still see the file in ~/.oga/assets but there's a block of stack trace every download. I'll work on that now.

@numberoverzero
Copy link
Owner

A little more research and a potential fix.

Here's a related issue in aiohttp which suggests that ProactorEventLoop on windows in general has shutdown problems.

A similar issue in httpx suggests this fix which I've pulled in. I'm going to try this again on a windows machine before releasing 1.0.3 with the fix.

And here's the python bug report from that last link.

@numberoverzero
Copy link
Owner

I've tested 1.0.3 on windows and released to pypi.
Please update and let me know if you're still seeing issues, otherwise I'll close this out in two days.

Thanks very much for the report!

@johanhelsing
Copy link
Contributor Author

Wow, that's a quick response!

Yeah, it's working now with 1.0.3 :)

Btw, I was a bit confused first, since I didn't see the file in the current working directory, but it appeared in .oga/assets, probably a nice feature, just saying it's not what I expected.

oga describe --verbose is also really nice. Thanks for sharing!

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

No branches or pull requests

2 participants