New SMTP connection for each mail batch
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 44.8k
- Forks
- 4.9k
- Avg merge
- 21h 23m
- Merged PRs (30d)
- 607
Description
Problem Statement
SMTP sender should open new connection at the start of the batch and close it after.
If I understand correctly mail backend opens new connection on first message and then reuses it forever.
If connection is closed or server become unavailable because of network issue SMTPServerDisconnected is raised.
Solution Brainstorm
Since mail send task runs periodically it makes sense to start a new connection each time.
Product Area
Unknown
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 with src/sentry/utils/email/send.py at the SMTP connection handling described in the issue. Trace how the mail send task processes a batch and where the connection is reused or closed. Done means each batch opens its own SMTP connection, closes it afterward, and no longer fails because of a stale connection; identify or add tests around that lifecycle.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100