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

[bug]在Windows平台上退出bot时报错 #61

Closed
shoucandanghehe opened this issue Feb 2, 2023 · 5 comments
Closed

[bug]在Windows平台上退出bot时报错 #61

shoucandanghehe opened this issue Feb 2, 2023 · 5 comments
Labels
wontfix This will not be worked on

Comments

@shoucandanghehe
Copy link
Contributor

Windows平台上使用nb-cli运行bot,并且设置FASTAPI_RELOAD=false时,Ctrl-C退出bot报错:

02-02 10:43:04 [INFO] logging | connection open
02-02 10:43:05 [INFO] logging | Shutting down
02-02 10:43:05 [WARNING] nonebot | OneBot V11 | WebSocket for Bot ********** closed by peer
02-02 10:43:05 [INFO] logging | connection closed
02-02 10:43:05 [INFO] logging | Finished server process [15776]
02-02 10:43:05 [ERROR] logging | Traceback (most recent call last):
  File "venv\path\Lib\site-packages\starlette\routing.py", line 674, in lifespan
    await receive()
  File "venv\path\Lib\site-packages\uvicorn\lifespan\on.py", line 137, in receive
    return await self.receive_queue.get()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\asyncio\queues.py", line 158, in get
    await getter
asyncio.exceptions.CancelledError

使用python bot.py运行正常

环境:

  • Windows 11 22623.1245
  • PowerShell 7.3.1
  • Python 3.11.1 bot-venv
  • nonebot2 2.0.0rc3
  • Python 3.9.12 nb-cli-venv
  • nb: nonebot cli version 1.0.3 使用pipx安装
@yanyongyu
Copy link
Member

yanyongyu commented Feb 2, 2023

上游问题,随机触发,忽略即可

nbcli也是运行的python bot.py没区别

@shoucandanghehe
Copy link
Contributor Author

上游问题

猜到了(
或许可以创建一个label upstream issues

随机触发,忽略即可

不过触发概率我这边测是10/10(

@yanyongyu
Copy link
Member

你可以试试启动nb然后啥也别连,等两三秒,再ctrl c

@shoucandanghehe
Copy link
Contributor Author

你可以试试启动nb然后啥也别连,等两三秒,再ctrl c

02-02 11:20:58 [INFO] logging | Started server process [31856]
02-02 11:20:58 [INFO] logging | Waiting for application startup.
02-02 11:20:58 [INFO] logging | Application startup complete.
02-02 11:20:58 [INFO] logging | Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
02-02 11:22:46 [INFO] logging | Shutting down
02-02 11:22:46 [INFO] logging | Finished server process [31856]
02-02 11:22:46 [ERROR] logging | Traceback (most recent call last):
  File "venv\path\Lib\site-packages\starlette\routing.py", line 674, in lifespan
    await receive()
  File "venv\path\Lib\site-packages\uvicorn\lifespan\on.py", line 137, in receive
    return await self.receive_queue.get()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\asyncio\queues.py", line 158, in get
    await getter
asyncio.exceptions.CancelledError

🤔

@yanyongyu
Copy link
Member

这问题uvicorn和starlette都得背一点锅,uvicorn在Windows上的处理到现在没修,starlette把CancelledError给捕获了

@yanyongyu yanyongyu added the wontfix This will not be worked on label Feb 2, 2023
@yanyongyu yanyongyu closed this as not planned Won't fix, can't repro, duplicate, stale Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Development

No branches or pull requests

2 participants