intel / asynch_mode_nginx

Other
209 stars 60 forks source link

nginx cpu 100% #80

Open weeweetan opened 2 weeks ago

weeweetan commented 2 weeks ago

https://github.com/intel/asynch_mode_nginx/blob/4023ec58d430dd6912c7ac4b54d0b74d5bb59ed6/src/event/ngx_event_openssl.c#L3662, What scenario is this solving? In the stream tls scenario, after nginx calls ssl_shutdown, the client does not respond, which will cause nginx cpu 100%

mcdullbloom commented 1 week ago

image

@weeweetan I meet the problem too. ngx_ssl_shutdown lead to single cpu core high usage.Is it the same?

weeweetan commented 1 week ago

@mcdullbloom yes, same problem, so I need the developer to confirm why these lines are added

mcdullbloom commented 1 week ago

how to reproduce?

weeweetan commented 1 week ago

@mcdullbloom after receiving the response, client calls the sleep function to block

mcdullbloom commented 1 week ago

I don't get it.What does the client should do after receive the response? Can you give more details?

weeweetan commented 1 week ago
ssl = SSL_new(ctx);
SSL_set_fd(ssl, sock);

if (SSL_connect(ssl) <= 0) {
    ERR_print_errors_fp(stderr);
} else {
    printf("Connected with %s encryption\n", SSL_get_cipher(ssl));
    SSL_write(ssl, "GET /HTTP/1.1\r\nHost: " HOSTNAME "\r\nConnection: close\r\n\r\n", strlen("GET / HTTP/1.1\r\nHost: " HOSTNAME "\r\nConnection: close\r\n\r\n"));

    char buffer[BUFFER_SIZE];
    int bytes;
    while ((bytes = SSL_read(ssl, buffer, sizeof(buffer))) > 0) {
        buffer[bytes] = 0;
        printf("%s", buffer);
    }
}
sleep(10000);
SSL_free(ssl);
close(sock);

implement a simple client like this