tortoise / tortoise/tortoise-orm
ConnectionDoesNotExistError, connection was closed in the middle of operation
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 516
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 9
Description
Hello
This exception rarely occures in our prod environment and I'm wondering if it's possible to fix it somehow, maybe by using some retry logic in queries.
We use tortoise along with FastAPI. Our default configuration is 10 MIN/MAX database pool size and 2 uvicorn workers.
I found the same issue https://github.com/tortoise/tortoise-orm/issues/134. That user created fork of this repo and tried to add logic with retry. Is this retry approach suitable for solving this problem?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading issue #134 and the linked fork's tortoise/backends/asyncpg/client.py, then trace how Tortoise handles a connection closing during an operation. Reproduce the failure if possible and establish whether retrying is safe; the issue needs a defined failure scenario, scope, and acceptance criteria before completion can be judged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fastapi, python
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100