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

Bot crashing due to the error "aiohttp.http_websocket.WebSocketError: Received fragmented control frame" #1170

Closed
3 tasks done
MarineMasta opened this issue Mar 19, 2024 · 1 comment · Fixed by #1180
Closed
3 tasks done
Labels
t: unconfirmed bug Type: bug - needs testing on if this is an issue

Comments

@MarineMasta
Copy link

Summary

Every few days, one of my bots will crash with the "received fragmented control frame" error

Reproduction Steps

Hard to reproduce, as it seems to be randomly triggered. Does happen every few days on bots that I have running 24/7.

Minimal Reproducible Code

No response

Expected Results

Error should be ignored or socket should close gracefully.

Actual Results

Traceback (most recent call last):
File "/bots/bot/script.py", line 2266, in
bot.run(TOKEN)
File "/usr/local/lib/python3.10/dist-packages/nextcord/client.py", line 863, in run
return future.result()
File "/usr/local/lib/python3.10/dist-packages/nextcord/client.py", line 842, in runner
await self.start(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/nextcord/client.py", line 806, in start
await self.connect(reconnect=reconnect)
File "/usr/local/lib/python3.10/dist-packages/nextcord/client.py", line 701, in connect
await self.ws.poll_event()
File "/usr/local/lib/python3.10/dist-packages/nextcord/gateway.py", line 615, in poll_event
raise msg.data
File "/usr/local/lib/python3.10/dist-packages/aiohttp/client_ws.py", line 196, in close
msg = await self._reader.read()
File "/usr/local/lib/python3.10/dist-packages/aiohttp/streams.py", line 657, in read
return await super().read()
File "/usr/local/lib/python3.10/dist-packages/aiohttp/streams.py", line 627, in read
raise self._exception
File "/usr/local/lib/python3.10/dist-packages/aiohttp/client_ws.py", line 229, in receive
msg = await self._reader.read()
File "/usr/local/lib/python3.10/dist-packages/aiohttp/streams.py", line 657, in read
return await super().read()
File "/usr/local/lib/python3.10/dist-packages/aiohttp/streams.py", line 616, in read
await self._waiter
File "/usr/local/lib/python3.10/dist-packages/aiohttp/http_websocket.py", line 288, in feed_data
return self._feed_data(data)
File "/usr/local/lib/python3.10/dist-packages/aiohttp/http_websocket.py", line 295, in _feed_data
for fin, opcode, payload, compressed in self.parse_frame(data):
File "/usr/local/lib/python3.10/dist-packages/aiohttp/http_websocket.py", line 459, in parse_frame
raise WebSocketError(
aiohttp.http_websocket.WebSocketError: Received fragmented control frame

Intents

Default

System Information

Python v3.10.6-final
nextcord v2.2.0-final
aiohttp v3.8.3
system info: Linux 5.15.0-52-generic

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

This is the same issue discord.py encountered a few months ago: Rapptz/discord.py#9561 (comment)

The fix for discord.py, which seems like it could be applied to nextcord's gateway.py: Rapptz/discord.py@163a86c

@MarineMasta MarineMasta added the t: unconfirmed bug Type: bug - needs testing on if this is an issue label Mar 19, 2024
@Kevin-OVI
Copy link
Contributor

My bots also crashed multiple times with this same error. I made a pull request implementing the fix from discord.py (#1180).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t: unconfirmed bug Type: bug - needs testing on if this is an issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants