intel / asynch_mode_nginx

Other
210 stars 61 forks source link

infinite loop,CPU 100% when use stream SSL module #38

Closed lizj3624 closed 2 years ago

lizj3624 commented 4 years ago

asynch_mode_nginx:v0.4.1 Deiver: qat1.7.l.4.9.0-00008 Qat_Engine:v0.5.44 OpenSSL-1.1.1g QATzip:v1.0.1

cat nginx.conf:

worker_processes 16; worker_cpu_affinity 01111111111111111000000000000000; user root;

error_log logs/error.log error;

pid nginx.pid;

load_module modules/ngx_ssl_engine_qat_module.so; load_module modules/ngx_http_qatzip_filter_module.so;

events { use epoll; worker_connections 102400; }

ssl_engine { use_engine qat; default_algorithms ALL; qat_engine { qat_offload_mode async; qat_notify_mode poll; qat_poll_mode heuristic; qat_sw_fallback on; } }

stream { upstream myngx_stream_ups { server 172.28.150.52:8881 weight=1 max_fails=3 fail_timeout=5s; server 172.28.150.52:8882 weight=1 max_fails=3 fail_timeout=5s; }

log_format main '$remote_addr [$time_local] '
             '$protocol $status $bytes_sent $bytes_received '
             '$session_time "$upstream_addr" '
             '"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"';
access_log logs/stream_access.log main  buffer=4k flush=5s;
server {
    listen 172.28.33.190:6443 ssl asynch reuseport;

    ssl_certificate      cert/jd;
    ssl_certificate_key  cert/jd;

    ssl_protocols  TLSv1.2 TLSv1.3;
    ssl_ciphers  ECDH+AESGCM:AES128+RSA:HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers on;
    ssl_session_cache   shared:STREAM_SSL:300m;
    ssl_session_timeout 24h;

    proxy_pass myngx_stream_ups;
}

server {
    listen 172.28.33.190:7443 reuseport;
    proxy_pass myngx_stream_ups;
}

} 企业咚咚20200701112152 企业咚咚20200701112215

strace -p 8684 sched_yield() = 0 sched_yield() = 0 sched_yield() = 0 sched_yield() = 0 sched_yield() = 0 sched_yield() = 0 .....

zhangp8x commented 4 years ago

Please try to update nginx.conf as following to avoid this problem.

listen 172.28.33.190:6443 ssl asynch reuseport; =>

listen 172.28.33.190:6443 ssl reuseport;
ssl_asynch on; 
lizj3624 commented 4 years ago

the issue is fixed

jazune commented 2 years ago

@zhangp8x ssl_asynch on; config can handle infinite loop for normal https request, but for proxy request, it not works. use proxy_ssl_asynch on; also not works.

image image image

jazune commented 2 years ago

@Yogaraj-Alamenda Can also help to see this question? Thank you.

jazune commented 2 years ago

It seems if qat_poll_mode set to external or heuristic, it will have the problem, if qat_poll_mode set to internal, it's ok.

yongchengmiao commented 2 years ago

Sorry, the issue of closed status has been ignored. We will reopen the issue.

ShuaiYuan21 commented 2 years ago

@jazune Can you update the qat_engine to latest version and test again? I cannot preproduce this issue.

jazune commented 2 years ago

@ShuaiYuan21 I also have this issue with the latest version, and it can be reproduced stably with your asynch_mode_nginx. Reproduction method: 1) qat_poll_mode heuristic; 2) the upstream of nginx is https request.

ShuaiYuan21 commented 2 years ago

This is a known issue, please use the internal polling mode to avoid this defect.