-
-
Notifications
You must be signed in to change notification settings - Fork 891
Closed
Labels
bugSomething is wrong with the frameworkSomething is wrong with the framework
Description
Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
- Operating System: archlinux
- Python Version: 3.8.2
- aiogram version: 2.7
- aiohttp version: 3.6.2
- uvloop version (if installed): nop
Expected Behavior
Please describe the behavior you are expecting.
after the update pipeline is ended should destroy all objects if aren't referenced in some code inside the handler
Current Behavior
What is the current behavior? objects aren't destroyed
Proof
with each message sent in response we will have how many objects that inherit TelegramObject are still alive, and as you can see it increases with each update
import logging
import gc
from aiogram import Bot, Dispatcher, executor, types
API_TOKEN = "YOUR TOKEN"
bot = Bot(token=API_TOKEN)
dp = Dispatcher(bot)
@dp.message_handler()
async def test(message: types.Message):
result = 0
gc.collect()
for obj in gc.get_objects():
if isinstance(obj, types.base.TelegramObject):
result += 1
await message.reply(str(result))
if __name__ == '__main__':
logging.basicConfig(level=logging.DEBUG)
gc.set_debug(gc.DEBUG_LEAK)
executor.start_polling(dp, skip_updates=True)
Metadata
Metadata
Assignees
Labels
bugSomething is wrong with the frameworkSomething is wrong with the framework