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

httpx.RemoteProtocolError: <ConnectionTerminated error_code:0, last_stream_id:1999, additional_data:None> #196

Closed
luckykeeper opened this issue Dec 24, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@luckykeeper
Copy link

看到 #1 有人提到了这个问题,但是没有提供样例供复测,这里提供一个样例可供复测尝试
OS: Windows 11 企业版 22H2
bilix version: 0.18.5

下载命令如下,多次尝试后总会在中间报错停止,每次停止不在同一p上,试了别的几个 up 的没有这个问题,似乎不是普遍性问题,为防止同时请求过多的原因,尝试通过 vc pc sl 加以限制,仍然如此,同一时间下载了别的几个 up 的视频,其它的可以正常下载,这个的就不行,很奇怪

bilix up 'https://space.bilibili.com/436476225' --dir ./ -vc 1 -pc 1 -sr 99 --image --subtitle --dm -n 99999999 -fb firefox -sl 2MB

截取一次报错信息如下,供分析,重试次数没有达到预期,出错的这个链接同时使用浏览器打开了一下,没有问题

INFO     已存在 ゲーム「金色ラブリッチェ」Complete Sound Track/SAGA PLANETS-P3-1.03.崇尚诺布尔之风-弹幕.ass
WARNING  GET RemoteProtocolError url: https://www.bilibili.com/video/BV1m44y1j7kF?p=4
WARNING  GET RemoteProtocolError url: https://www.bilibili.com/video/BV1m44y1j7kF?p=4
WARNING  GET RemoteProtocolError url: https://www.bilibili.com/video/BV1m44y1j7kF?p=4
WARNING  GET RemoteProtocolError url: https://www.bilibili.com/video/BV1m44y1j7kF?p=4
WARNING  GET RemoteProtocolError url: https://www.bilibili.com/video/BV1m44y1j7kF?p=4
ERROR    GET 超过重复次数 https://www.bilibili.com/video/BV1m44y1j7kF?p=4

Traceback (most recent call last):
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\h2\connection.py", line 224, in process_input
    func, target_state = self._transitions[(self.state, input_)]
                         ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
KeyError: (<ConnectionState.CLOSED: 3>, <ConnectionInputs.SEND_HEADERS: 0>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\httpcore\_async\http2.py", line 106, in handle_async_request
    await self._send_request_headers(request=request, stream_id=stream_id)
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\httpcore\_async\http2.py", line 203, in _send_request_headers
    self._h2_state.send_headers(stream_id, headers, end_stream=end_stream)
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\h2\connection.py", line 766, in send_headers
    self.state_machine.process_input(ConnectionInputs.SEND_HEADERS)
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\h2\connection.py", line 228, in process_input
    raise ProtocolError(
h2.exceptions.ProtocolError: Invalid input ConnectionInputs.SEND_HEADERS in state ConnectionState.CLOSED

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\httpx\_transports\default.py", line 60, in map_httpcore_exceptions
    yield
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\httpx\_transports\default.py", line 353, in handle_async_request
    resp = await self._pool.handle_async_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\httpcore\_async\connection_pool.py", line 253, in handle_async_request
    raise exc
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\httpcore\_async\connection_pool.py", line 237, in handle_async_request
    response = await connection.handle_async_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\httpcore\_async\connection.py", line 90, in handle_async_request
    return await self._connection.handle_async_request(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\httpcore\_async\http2.py", line 139, in handle_async_request
    raise RemoteProtocolError(self._connection_error_event)
httpcore.RemoteProtocolError: <ConnectionTerminated error_code:0, last_stream_id:1999, additional_data:None>

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

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Scripts\bilix.exe\__main__.py", line 7, in <module>
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\bilix\cli\main.py", line 374, in main
    loop.run_until_complete(cor)
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\bilix\sites\bilibili\downloader.py", line 266, in get_up
    await asyncio.gather(*cors)
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\bilix\sites\bilibili\downloader.py", line 276, in _get_up_by_page
    await asyncio.gather(
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\bilix\download\base_downloader.py", line 75, in wrapper
    return await func(*new_args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\bilix\sites\bilibili\downloader.py", line 312, in get_series
    await asyncio.gather(*cors)
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\bilix\download\base_downloader.py", line 75, in wrapper
    return await func(*new_args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\bilix\sites\bilibili\downloader.py", line 335, in get_video
    video_info = await api.get_video_info(self.client, url)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\bilix\download\utils.py", line 90, in wrapped
    return await func(client, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\bilix\sites\bilibili\api.py", line 399, in get_video_info
    return await _get_video_info_from_html(client, url)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\bilix\sites\bilibili\api.py", line 406, in _get_video_info_from_html
    res = await req_retry(client, url, follow_redirects=True)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\bilix\download\utils.py", line 49, in req_retry
    raise pre_exc
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\bilix\download\utils.py", line 32, in req_retry
    res = await client.request(method, url, follow_redirects=follow_redirects, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\httpx\_client.py", line 1533, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\httpx\_client.py", line 1620, in send
    response = await self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\httpx\_client.py", line 1648, in _send_handling_auth
    response = await self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\httpx\_client.py", line 1685, in _send_handling_redirects
    response = await self._send_single_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\httpx\_client.py", line 1722, in _send_single_request
    response = await transport.handle_async_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\httpx\_transports\default.py", line 352, in handle_async_request
    with map_httpcore_exceptions():
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File "C:\Users\Luckykeeper\AppData\Local\Programs\Python\Python311\Lib\site-packages\httpx\_transports\default.py", line 77, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.RemoteProtocolError: <ConnectionTerminated error_code:0, last_stream_id:1999, additional_data:None>
@HFrost0 HFrost0 added the bug Something isn't working label Dec 25, 2023
@HFrost0 HFrost0 self-assigned this Dec 25, 2023
@HFrost0
Copy link
Owner

HFrost0 commented Jan 9, 2024

未能复现

@HFrost0 HFrost0 closed this as completed Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants