I've encountered thisrelated 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.
Present in both answers;
Present only in the new answer;
Present only in the old answer;