nginx for Windows - WSASend() socket error 10057

Maxim Dounin mdounin at mdounin.ru
Fri Feb 28 13:25:57 UTC 2020


Hello!

On Thu, Feb 27, 2020 at 07:40:38PM +0000, Yury Shpakov wrote:

> I wrote my own auth_http server. And it was hit only one time for 1000 SMTP requests.
> So auth_http is requested once per session/connection.

There is no such thing as "SMTP requests".  And yes, that's 
expected that's auth_http is called once per connection: auth_http 
is only called for authentication, non for each SMTP command.

> For this example it's hit once:
> 
> using (var smtpClient = new SmtpClient("localhost", 8025) { Timeout = 60 * 60 * 1000 })
> {
>     for (int i = 0; i < 1000; i++)
>     {
>         smtpClient.Send("noreply at wmata.com", "ys at wmata.com", "Email subject", "Email body");
>     }
> }
> 
> 
> For this example it's hit 1000 times:
> 
> for (int i = 0; i < 1000; i++)
> {
>     using (var smtpClient = new SmtpClient("localhost", 8025) { Timeout = 60 * 60 * 1000 })
>     {
>         smtpClient.Send("noreply at wmata.com", "ys at wmata.com", "Email subject", "Email body");
>     }
> }

The difference is that in the first example you establish one 
connection and use it to send 1000 messages, while in the second 
example you establish 1000 connections - and each of them calls 
auth_http.

> Evidently by the same reason this one didn't work either:
> smtp_greeting_delay 10s;

This directive delays SMTP greeting.  It is expected to happen 
only once per connection, see here for an overview of the SMTP 
protocol:

https://tools.ietf.org/html/rfc5321

> This options is not gonna work either:
> - Maxim's ngx_http_delay (I used it more for development purposes, like test or simulation of load etc);

That's expected as well, as the delay module is to delay HTTP 
requsets, not SMTP commands.

> If I do this I don't need nginx at all. But my boss said: "Use nginx. Period.":
> - some "slow" upstream backend that doing nothing, just waiting (preferably asynchronous).
> 
> So the question is still open: how to make nginx wait on SMTP 
> processing to model latency for my load tests?

If you are trying to model latency within a single SMTP 
connection, the answer is: you can't do this with nginx, as nginx 
does not try to do anything with an established and authenticated 
connection SMTP connnection, and doesn't even try to parse what 
happens on such a connection.  It merely proxies bytes between the 
client and the backend server.

Either way, this thread looks like an off-topic for the 
nginx-devel@ mailing list.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx-devel mailing list