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

Fragmented control frame causes crash #693

Open
3 tasks done
AndKe opened this issue May 10, 2024 · 1 comment
Open
3 tasks done

Fragmented control frame causes crash #693

AndKe opened this issue May 10, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@AndKe
Copy link

AndKe commented May 10, 2024

Summary

aiohttp.http_websocket.WebSocketError: Received fragmented control frame

Reproduction Steps

Run the plugin, and wait for this to happen:

Code

2024-05-10 03:14:55 INFO     discord.gateway Gateway has successfully RESUMED session 0371eeb1a7104f8e5bb07831b63265ad.
Traceback (most recent call last):
  File "/home/andre/prog/PycharmProjects/mav-progs/t.py", line 96, in <module>
    run_bot('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') 
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/andre/prog/PycharmProjects/mav-progs/t.py", line 77, in run_bot
    client.run(token)
  File "/home/andre/prog/PycharmProjects/mav-progs/venv/lib/python3.12/site-packages/discord/client.py", line 1106, in run
    asyncio.run(runner())
  File "/usr/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/andre/prog/PycharmProjects/mav-progs/venv/lib/python3.12/site-packages/discord/client.py", line 1095, in runner
    await self.start(token, reconnect=reconnect)
  File "/home/andre/prog/PycharmProjects/mav-progs/venv/lib/python3.12/site-packages/discord/client.py", line 1026, in start
    await self.connect(reconnect=reconnect)
  File "/home/andre/prog/PycharmProjects/mav-progs/venv/lib/python3.12/site-packages/discord/client.py", line 907, in connect
    await self.ws.poll_event()
  File "/home/andre/prog/PycharmProjects/mav-progs/venv/lib/python3.12/site-packages/discord/gateway.py", line 626, in poll_event
    raise msg.data
  File "/home/andre/prog/PycharmProjects/mav-progs/venv/lib/python3.12/site-packages/aiohttp/client_ws.py", line 244, in receive
    msg = await self._reader.read()
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/andre/prog/PycharmProjects/mav-progs/venv/lib/python3.12/site-packages/aiohttp/streams.py", line 681, in read
    return await super().read()
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/andre/prog/PycharmProjects/mav-progs/venv/lib/python3.12/site-packages/aiohttp/streams.py", line 640, in read
    await self._waiter
  File "/home/andre/prog/PycharmProjects/mav-progs/venv/lib/python3.12/site-packages/aiohttp/http_websocket.py", line 314, in feed_data
    return self._feed_data(data)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/andre/prog/PycharmProjects/mav-progs/venv/lib/python3.12/site-packages/aiohttp/http_websocket.py", line 321, in _feed_data
    for fin, opcode, payload, compressed in self.parse_frame(data):
                                            ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/andre/prog/PycharmProjects/mav-progs/venv/lib/python3.12/site-packages/aiohttp/http_websocket.py", line 486, in parse_frame
    raise WebSocketError(
aiohttp.http_websocket.WebSocketError: Received fragmented control frame

Expected Results

I's expect it to just ignore the fragmented frame, if not able to put it together

Actual Results

see above

System Information

$ python -m discord -v

Checklist

  • I have searched the open issues for duplicates.
  • I have shared the entire traceback.
  • I am using a user token (and it isn't visible in the code).

Additional Information

No response

@AndKe AndKe added the unconfirmed bug Unconfirmed bug label May 10, 2024
@dolfies dolfies added bug Something isn't working and removed unconfirmed bug Unconfirmed bug labels May 15, 2024
@dolfies
Copy link
Owner

dolfies commented May 15, 2024

This is a Discord issue; their websocket should not be sending fragmented frames. However, I'll implement a fix for this soon as it doesn't look like they're fixing it.

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