Skip to content

Entire python process stalls when receiving multiple large inbound emails #293

@davidmcnabnz

Description

@davidmcnabnz

I'd rate this as a critical bug, unless a workaround has already been found (didn't see anything in my reading of the docs),

My asyncio process instantiates a Controller, then starts it. In the separate thread started by the Controller object, aiosmtpd opens an inbound port and listens for sessions. So far so good, all pretty normal.

But at times when multiple external clients are simultaneously injecting large-ish (>5MB) messages, the entire python process -- all event loops, all threads -- grinds to a complete halt.

My tests have been to get an external machine to simultaneously inject 10 messages, of 20MB each, into my SMTPD port. I provide my Controller object with a null stub handle_DATA() hook, which simply returns "250 Accepted".

Every time I run this test, the entire process freezes for between 10.5 and 18 seconds, until the injections are complete.

I'm guessing this is a GIL issue. My "main" thread and asyncio event loop freezes, along with everything running within that process.

I'm considering a radical option of spawning a separate aiosmtpd-based subprocess, and having its handle_DATA() hook throw the received envelopes into a pipeline, where they get pickled then base64'ed and passed via subproc stdout to the parent process.

I truly hope there's a better way. Can anyone please advise a more satisfactory remedy or workaround?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions