disnake
disnake copied to clipboard
Delayed command sync is not cancelled on termination
Summary
Delayed command sync is not cancelled on termination
Reproduction Steps
When shutting down the bot, the delayed_command_sync
task fails to be cancelled as it's in a pending state. Note that this occurs when no slash commands are registered.
ERROR:asyncio:Task was destroyed but it is pending!
task: <Task pending name='disnake: delayed_command_sync' coro=<InteractionBotBase._delayed_command_sync() done, defined at disnake/ext/commands/interaction_bot_base.py:795> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x10af24160>()]>>
Minimal Reproducible Code
No response
Expected Results
There should not be unhandled errors when shutting down.
Actual Results
There are internal errors on shutdown.
Intents
N/A
System Information
https://github.com/EQUENOS/disnake/commit/74403d440ee786bd9b5361e340a9c5439b932b53
Checklist
- [X] I have searched the open issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have removed my token from display, if visible.
Additional Context
No response
Thank you for reporting this, it's now fixed
Thank you for reporting this, it's now fixed
You sure? Can continue to reproduce with this environment.
- Python v3.8.11-final
- disnake v2.2.1-beta
- disnake pkg_resources: v2.2.1
- aiohttp v3.7.4.post0
Installation was with pip install "disnake[discord]"
I have also reproduced this issue on py 3.10
And with the current master branch (which installs as 2.2.0, even though 2.2.1 is what is on pypi)
And without the shims as well. I believe there is some problem with subclassing the bot and implementing custom methods, so I will removing and modifying those.
I have also reproduced this issue on py 3.10
And with the current master branch (which installs as 2.2.0, even though 2.2.1 is what is on pypi)
And without the shims as well. I believe there is some problem with subclassing the bot and implementing custom methods, so I will removing and modifying those.
This issue should not happen unless you overwrite the close
method. Could you share more details?
I have also reproduced this issue on py 3.10
And with the current master branch (which installs as 2.2.0, even though 2.2.1 is what is on pypi)
And without the shims as well. I believe there is some problem with subclassing the bot and implementing custom methods, so I will removing and modifying those.
This issue should not happen unless you overwrite the
close
method. Could you share more details?
I have overwritten the close method, but is also calls the super's close method. I will experiment more with disnake tomorrow and update again.
Turns out this happens unless I have around a two second wait after I await super().close()
And it somehow seems related to my own aiohttp session, very confused.
I can no longer recreate this, so either its been fixed, or there's a lot of requirements.
What a coincidence, I wanted to close this issue today!
As evidenced by logs today, this is still occuring. TLDR we're using create_task when we should be saving the task and canceling it when closing the class object.