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

Disable aiohttp client timeout #689

Closed
wants to merge 1 commit into from
Closed

Disable aiohttp client timeout #689

wants to merge 1 commit into from

Conversation

wvffle
Copy link

@wvffle wvffle commented May 24, 2024

A fix for RuntimeWarning: coroutine 'Artist._download_async.<locals>._rip' was never awaited error message

Potentially fixes: #555, #580, #645

@mortalis13
Copy link
Contributor

Possibly for #672? The error at the end of debug log is similar

@wvffle
Copy link
Author

wvffle commented May 24, 2024

Important thing to note: This needs further testing. I've successfully downloaded files that took over 5 minutes (default aiohttp client timeout). However, when testing with some artist, after some time, it still crashed with the same error message

@mortalis13
Copy link
Contributor

Those issues are different I think, and the coroutine was never awaited warning is just a result of terminated script, when you press Ctrl+C it gives the same, so it terminates forcefully.

The reason should be checked in the previous messages.
In #555 the log wasn't provided by the OP, the other user's log indicates the WrongGeolocation error (probably the reason for interruption).

The #580 user haven't explained the details of his problem, I'd say he pressed Ctrl+C because of not available for stream errors, which are response from the service, not a problem of the tool.
Or, it could be, because of 410 error response...

#645, WrongGeolocation again, and the user doesn't provide the exact command that caused error, the download command.

#689, the error is TypeError: sequence item 0: expected str instance, NoneType found.

So they probably should be treated separately, and require different solutions.

@mortalis13
Copy link
Contributor

Could you share the debug log that you get when it crashes?
Supposing you don't end it with Ctrl+C, it should give a more detailed reason.

@mortalis13
Copy link
Contributor

mortalis13 commented May 25, 2024

Another example, as I've run the command from #580, it terminated itself with another error

┌─────────────────────────────── Traceback (most recent call last) ────────────────────────────────┐
│ D:\Program Files\Python311\Lib\asyncio\proactor_events.py:401 in _loop_writing                   │
│                                                                                                  │
│ D:\Program Files\Python311\Lib\asyncio\windows_events.py:574 in send                             │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

The above exception was the direct cause of the following exception:

┌─────────────────────────────── Traceback (most recent call last) ────────────────────────────────┐
│ in _run_module_as_main:198                                                                       │
│ in _run_code:88                                                                                  │
│                                                                                                  │
│                                     ... 25 frames hidden ...                                     │
│                                                                                                  │
│ D:\Program Files\Python311\Lib\site-packages\aiohttp\client_reqrep.py:976 in start               │
│                                                                                                  │
│    973 │   │   │   │   # read response                                                           │
│    974 │   │   │   │   try:                                                                      │
│    975 │   │   │   │   │   protocol = self._protocol                                             │
│ >  976 │   │   │   │   │   message, payload = await protocol.read()  # type: ignore[union-attr]  │
│    977 │   │   │   │   except http.HttpProcessingError as exc:                                   │
│    978 │   │   │   │   │   raise ClientResponseError(                                            │
│    979 │   │   │   │   │   │   self.request_info,                                                │
│                                                                                                  │
│ D:\Program Files\Python311\Lib\site-packages\aiohttp\streams.py:640 in read                      │
│                                                                                                  │
│   637 │   │   │   assert not self._waiter                                                        │
│   638 │   │   │   self._waiter = self._loop.create_future()                                      │
│   639 │   │   │   try:                                                                           │
│ > 640 │   │   │   │   await self._waiter                                                         │
│   641 │   │   │   except (asyncio.CancelledError, asyncio.TimeoutError):                         │
│   642 │   │   │   │   self._waiter = None                                                        │
│   643 │   │   │   │   raise                                                                      │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
ClientOSError: [WinError 10053] An established connection was aborted by the software in your host machine
sys:1: RuntimeWarning: coroutine 'Artist._download_async.<locals>._rip' was never awaited

Which I don't know where comes from, as "host machine" is my PC as I understand,
and it could be another timeout, or denial by the external service...

Will check with full debug and with the full stack trace, though don't know how to show it yet )

@mortalis13
Copy link
Contributor

btw, it would be more useful to have a test reproducing/simulating the problem
I'm not strong in async python, but will try to make one to see if there's some timeout that can be simulated for async tasks maybe...
or directly rising an exception from one of the tickets.

@nathom
Copy link
Owner

nathom commented Jun 3, 2024

As @mortalis13 said, this is caused by uncaught exceptions, which terminates the program without resolving the coroutines in the event loop. It's not an error, just a message to notify the dev in case a coroutine was created but never resolved. Changing the client timeout won't change anything.

The message is just an indicator that there is another error.

@nathom nathom closed this Jun 3, 2024
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

Successfully merging this pull request may close these issues.

[BUG] Timeout Errors
3 participants