cosullivan / SmtpServer

A SMTP Server component written in C#
MIT License
692 stars 163 forks source link

Added a lot of missing ConfigureAwait(false) statements #101

Closed ramonsmits closed 5 years ago

ramonsmits commented 5 years ago

Added a lot of missing ConfigureAwait(false) statements, refactored ReturnOnAnyThread -> .ConfigureAwait(false) as that is very confusing for outsiders.

I'm currently experiencing blocking issues due to SmtpServer. It seems to be starving the thread/taskpool.

cosullivan commented 5 years ago

Hi, thanks for your PR.

I will accept this because you've done the work to add the missing ConfigureAwait's but on a personal level I disagree about the readability of that method as I think ConfigureAwait(false) is one of the most poorly name method & parameter combinations that I've ever come accros.

With regards to your blocking issues that you are experiencing, do you have a sample that reproduces this? If so I can assist in debugging.

I did previously have a performance test harness that I used to run which would send through emails from the Enron Corpus database. I can try to find that and run it against your sample.

Thanks, Cain.

ramonsmits commented 5 years ago

@cosullivan The application where I see this happening does this: Run smtpservice instance that on a message receive publishes the email via mqtt on rabbitmq. When sending a bunch of concurrent emails to it the mqtt stuff results in timeouts. I'm not experiencing this when I just publish the same or many more messages concurrently. At the moment I think it is something in the networking code but as this is a hobby project I don't have much time to research. I'll try to make it as small as possible.

ramonsmits commented 5 years ago

By the way, would it be possible to release the current master on nuget?

cosullivan commented 5 years ago

I have pushed a new version from master.

Thanks, Cain.