GraiaProject / Application

一个设计精巧, 协议实现完备的, 基于 mirai-api-http 的即时聊天软件自动化框架.
https://graia-document.vercel.app/
GNU Affero General Public License v3.0
438 stars 63 forks source link

Set changed size during iteration #63

Closed xian18 closed 3 years ago

xian18 commented 3 years ago

描述你遇到的问题:

收到群消息后会出现这个Exception

raceback (most recent call last):
  File "/anaconda3/lib/python3.7/site-packages/graia/broadcast/__init__.py", line 240, in Executor
    await dii.lookup_param(name, annotation, default)
  File "/anaconda3/lib/python3.7/site-packages/graia/broadcast/interfaces/dispatcher.py", line 227, in lookup_param
    lambda x: [DispatcherSource(self.execution_contexts[-1].always_dispatchers)]
  File "/anaconda3/lib/python3.7/site-packages/graia/broadcast/interfaces/dispatcher.py", line 143, in dispatcher_generator
    for dispatcher in source.dispatchers:
RuntimeError: Set changed size during iteration

复现步骤: 该 BUG 会在进行以下操作后出现:

  1. 发送两条群消息

发生错误的代码

from graia.application.entry import GraiaMiraiApplication
from graia.broadcast import Broadcast
import asyncio
from graia.application.session import Session

loop=asyncio.get_event_loop()
bcc=Broadcast(loop=loop)
app=GraiaMiraiApplication(
    broadcast=bcc,
    connect_info=Session(
        host='http://127.0.0.1:800000',   #你mirai-api-http监听的地址以及端口
        authKey='mirai-api-http-token',      #在mirai-api-http设置的authKey
        account="qq number",             #要使用的对应的bot 的qq号
        websocket=True                  #记得在mirai-api-http里面设置开启websocket
    ),
    enable_chat_log=True,
    debug=True
)
app.launch_blocking()

控制台日志输出截图:

Screenshot from 2020-12-05 14-12-53

运行环境:

额外信息:

只使用BroadCast(在尝试简化代码)貌似没有这个问题.

GreyElaina commented 3 years ago

graia-broadcast 更新到 0.5.2 即可.

GreyElaina commented 3 years ago

*0.5.3, 我忘记删abc class的def了(