bcoe / bcoe/secure-smtpd

ssl.SSLWantReadError not being handled

Open
#36 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
123
Forks
41
PR merge metrics
No merged PRs in 30d

Description

Any time I receive messages with a body longer than a few dozen bytes, I get a failure that looks like this (I've add a bit of extra info to the normal log messages in smtp_server.py):

```
2018-01-17 21:38:59,100 smtpfwd[2144]: INFO: _accept_subprocess(): smtp connection accepted within subprocess: (, ('nnn.nnn.nnn.nnn', 33114)).
2018-01-17 21:38:59,138 smtpfwd[2144]: INFO: _accept_subprocess(): starting asyncore within subprocess. map={10: }
2018-01-17 21:38:59,342 smtpfwd[2144]: INFO: login by [elided] OK
2018-01-17 21:38:59,458 smtpfwd[2144]: ERROR: _accept_subprocess(): asyncore loop exited.
```
AFAICT, in this failure case my message handler is never being called at all.

How do I find out what the problem is?

Shorter messages seem to work fine and the log looks like this:
```
2018-01-17 21:23:10,748 smtpfwd[1804]: INFO: _accept_subprocess(): starting asyncore within subprocess. map={9: }
2018-01-17 21:23:10,938 smtpfwd[1804]: INFO: login by [elided] OK
[... status messages from my message handler ...]
2018-01-17 21:23:12,301 smtpfwd[1804]: INFO: _accept_subprocess(): smtp channel terminated asyncore.
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in smtp_server.py and trace the asyncore loop after an SSL connection receives a body longer than a few dozen bytes. Reproduce the failure while capturing the full exception, including SSLWantReadError, and inspect how that condition is handled before the loop exits. Done means long messages complete normally, the asyncore loop remains active, and the message handler is called.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.