getsentry / getsentry/sentry

New SMTP connection for each mail batch

Open
#96,288 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Product Area: Alerts
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.