I've encountered this issues before(with FastAPI), and the root cause was that some database connections didn't close successfully. After extensive experimentation, I discovered that if a coroutine within `asyncio.gather` raised an exception, it could potentially lead to issues with closing the database connections used in other coroutines. Therefore, my advice is to avoid using async sessions within any `asyncio.gather` to prevent such problems.
I've encountered related issues before, and the root cause was that some database connections didn't close successfully. After extensive experimentation, I discovered that if a coroutine within `asyncio.gather` raised an exception, it could potentially lead to issues with closing the database connections used in other coroutines. Therefore, my advice is to avoid using async sessions within any `asyncio.gather` to prevent such problems.