不一致警告:“分片 ID 无心跳阻塞超过 10 秒”但没有使用阻塞函数
我正在向在 Docker 内运行的现有 python 多线程程序添加 Discord 功能,但我在日志中不断收到相同的错误:
[2022-03-09 17:58:45,133][WARNING] Shard ID None heartbeat blocked for more than 10 seconds.
Loop thread traceback (most recent call last):
File "/root/bagley/bagley.py", line 51, in <module>
lib.bot.initBot(controller)
File "/root/bagley/lib/bot.py", line 106, in initBot
bot.run(config.DISCORD_TOKEN)
File "/usr/local/lib/python3.8/dist-packages/discord/client.py", line 713, in run
loop.run_forever()
File "/usr/lib/python3.8/asyncio/base_events.py", line 570, in run_forever
self._run_once()
File "/usr/lib/python3.8/asyncio/base_events.py", line 1859, in _run_once
handle._run()
File "/usr/lib/python3.8/asyncio/events.py", line 81, in _run
self._context.run(self._callback, *self._args)
File "/usr/local/lib/python3.8/dist-packages/discord/client.py", line 702, in runner
await self.start(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/discord/client.py", line 666, in start
await self.connect(reconnect=reconnect)
File "/usr/local/lib/python3.8/dist-packages/discord/client.py", line 566, in connect
await self.ws.poll_event()
File "/usr/local/lib/python3.8/dist-packages/discord/gateway.py", line 559, in poll_event
await self.received_message(msg.data)
File "/usr/local/lib/python3.8/dist-packages/discord/gateway.py", line 427, in received_message
msg = self._zlib.decompress(self._buffer)
我已经阅读了 另一个问题在这里讨论了同样的问题,但是,我100% 确定机器人正在运行的代码没有任何阻塞函数,并且异常消息似乎与来自discord.py 的内部函数相关。我认为问题是我的计算机无法完全运行带有这个大程序的 docker 容器,因此它有时会被阻止并且无法发送和接收此心跳,但我真的不知道发生了什么。
多谢。
编辑:
我没有提到如果我在 Docker 之外运行程序,没有问题,但是,我们的想法是能够在 VPS 中轻松部署程序,因此不使用 Docker 不是一个选择。
I'm adding Discord capabilities to an existing python multithreaded program which is running inside Docker, but I keep getting the same error in the logs:
[2022-03-09 17:58:45,133][WARNING] Shard ID None heartbeat blocked for more than 10 seconds.
Loop thread traceback (most recent call last):
File "/root/bagley/bagley.py", line 51, in <module>
lib.bot.initBot(controller)
File "/root/bagley/lib/bot.py", line 106, in initBot
bot.run(config.DISCORD_TOKEN)
File "/usr/local/lib/python3.8/dist-packages/discord/client.py", line 713, in run
loop.run_forever()
File "/usr/lib/python3.8/asyncio/base_events.py", line 570, in run_forever
self._run_once()
File "/usr/lib/python3.8/asyncio/base_events.py", line 1859, in _run_once
handle._run()
File "/usr/lib/python3.8/asyncio/events.py", line 81, in _run
self._context.run(self._callback, *self._args)
File "/usr/local/lib/python3.8/dist-packages/discord/client.py", line 702, in runner
await self.start(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/discord/client.py", line 666, in start
await self.connect(reconnect=reconnect)
File "/usr/local/lib/python3.8/dist-packages/discord/client.py", line 566, in connect
await self.ws.poll_event()
File "/usr/local/lib/python3.8/dist-packages/discord/gateway.py", line 559, in poll_event
await self.received_message(msg.data)
File "/usr/local/lib/python3.8/dist-packages/discord/gateway.py", line 427, in received_message
msg = self._zlib.decompress(self._buffer)
I have already read another question in here where this same issue is discussed, however, I'm 100% sure that the code that the bot is running doesn't have any blocking functions and the Exception message seems to be related to internal functions from discord.py. I think that the problem is that my computer is not able to fully run the docker container with this big program so it sometimes gets blocked and it's unable to send and receive this heartbeat, but I really don't know what is happening.
Thanks a lot.
Edit:
I didn't mention that if I run the program out of Docker, there is no problem, however, the idea is to be able to deploy the program easily in a VPS, so not using Docker is not an option.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论