Closed defanator closed 3 years ago
With the below configuration nginx worker segfaults immediately on start:
$ cat nginx-segfault-on-worker-start.conf worker_processes 1; load_module modules/ngx_ssl_engine_qat_module.so; error_log /home/dvuser14/sandbox/error.log info; pid /home/dvuser14/sandbox/nginx.pid; #ssl_engine { # This directive enables the use of QAT offload. If "ssl_engine" is ommitted, then software will be used # use_engine qatengine; # default_algorithms ALL; # qat_engine { # qat_notify_mode poll; # qat_offload_mode async; # qat_external_poll_interval 1; # } #} events {} http {}
Backtrace:
(gdb) bt full #0 ngx_ssl_engine_qat_process_init (cycle=0x55af0eb25a20) at modules/nginx_qat_module//ngx_ssl_engine_qat_module.c:1123 conf = <optimized out> #1 0x000055af0cf9294e in ngx_worker_process_init (cycle=cycle@entry=0x55af0eb25a20, worker=worker@entry=0) at src/os/unix/ngx_process_cycle.c:950 set = {__val = {0 <repeats 16 times>}} n = <optimized out> tp = <optimized out> i = <optimized out> cpu_affinity = <optimized out> rlmt = {rlim_cur = 140721928421624, rlim_max = 1} ccf = <optimized out> ls = <optimized out> #2 0x000055af0cf92e1a in ngx_worker_process_cycle (cycle=cycle@entry=0x55af0eb25a20, data=data@entry=0x0) at src/os/unix/ngx_process_cycle.c:745 worker = 0 #3 0x000055af0cf9146b in ngx_spawn_process (cycle=cycle@entry=0x55af0eb25a20, proc=0x55af0cf92df0 <ngx_worker_process_cycle>, data=0x0, name=0x55af0cff5a33 "worker process", respawn=respawn@entry=1) at src/os/unix/ngx_process.c:199 on = 1 pid = 0 s = 1 #4 0x000055af0cf93bc4 in ngx_reap_children (cycle=0x55af0eb25a20) at src/os/unix/ngx_process_cycle.c:633 i = <optimized out> live = 0 n = <optimized out> ch = {command = 2, pid = 297231, slot = 1, fd = -1} ccf = <optimized out> i = <optimized out> n = <optimized out> live = <optimized out> ch = <optimized out> ccf = <optimized out> #5 ngx_master_process_cycle (cycle=0x55af0eb25a20) at src/os/unix/ngx_process_cycle.c:177 title = <optimized out> p = <optimized out> size = <optimized out> i = <optimized out> n = <optimized out> sigio = 0 set = {__val = {0 <repeats 16 times>}} itv = {it_interval = {tv_sec = 94210354199220, tv_usec = 0}, it_value = {tv_sec = 0, tv_usec = 0}} live = <optimized out> delay = 0 ls = <optimized out> ccf = 0x55af0eb26a98 #6 0x000055af0cf6aadc in main (argc=<optimized out>, argv=<optimized out>) at src/core/nginx.c:389 b = <optimized out> log = <optimized out> i = <optimized out> cycle = 0x55af0eb21a10 init_cycle = {conf_ctx = 0x0, pool = 0x55af0eb05cf0, log = 0x55af0d22a560 <ngx_log>, new_log = {log_level = 0, file = 0x0, connection = 0, disk_full_time = 0, handler = 0x0, data = 0x0, writer = 0x0, wdata = 0x0, action = 0x0, next = 0x0}, log_use_stderr = 0, files = 0x0, free_connections = 0x0, free_connection_n = 0, modules = 0x0, modules_n = 0, modules_used = 0, reusable_connections_queue = {prev = 0x0, next = 0x0}, reusable_connections_n = 0, listening = {elts = 0x0, nelts = 0, size = 0, nalloc = 0, pool = 0x0}, paths = {elts = 0x0, nelts = 0, size = 0, nalloc = 0, pool = 0x0}, config_dump = {elts = 0x0, nelts = 0, size = 0, nalloc = 0, pool = 0x0}, config_dump_rbtree = {root = 0x0, sentinel = 0x0, insert = 0x0}, config_dump_sentinel = {key = 0, left = 0x0, right = 0x0, parent = 0x0, color = 0 '\000', data = 0 '\000'}, open_files = {last = 0x0, part = {elts = 0x0, nelts = 0, next = 0x0}, size = 0, nalloc = 0, pool = 0x0}, shared_memory = {last = 0x0, part = {elts = 0x0, nelts = 0, next = 0x0}, size = 0, nalloc = 0, pool = 0x0}, connection_n = 0, files_n = 0, connections = 0x0, read_events = 0x0, write_events = 0x0, async_events = 0x0, old_cycle = 0x0, conf_file = {len = 37, data = 0x55af0eb05d40 " "}, conf_param = {len = 0, data = 0x0}, conf_prefix = {len = 27, data = 0x55af0eb05d40 " "}, prefix = {len = 27, data = 0x7ffc608e5475 "l/nginx/sbin/nginx -p /tmp/nginx-test-w9Kc7SxfE9/ -c nginx.conf"}, lock_file = {len = 0, data = 0x0}, hostname = { len = 0, data = 0x0}, no_ssl_init = 0} cd = <optimized out> ccf = <optimized out> (gdb)
With the empty ssl_engine {} block, nginx worker segfaults on exit; configuration:
$ cat nginx-segfault-on-worker-exit.conf worker_processes 1; load_module modules/ngx_ssl_engine_qat_module.so; error_log /home/dvuser14/sandbox/error.log info; pid /home/dvuser14/sandbox/nginx.pid; ssl_engine { # This directive enables the use of QAT offload. If "ssl_engine" is ommitted, then software will be used # use_engine qatengine; # default_algorithms ALL; # qat_engine { # qat_notify_mode poll; # qat_offload_mode async; # qat_external_poll_interval 1; # } } events {} http {}
(gdb) bt full #0 0x00007fe716dead00 in ?? () No symbol table info available. #1 0x00007fe717958b61 in engine_pkey_meths_free () from /usr/local/ssl/lib/libcrypto.so.1.1 No symbol table info available. #2 0x00007fe717955fa2 in engine_free_util () from /usr/local/ssl/lib/libcrypto.so.1.1 No symbol table info available. #3 0x00007fe7179567d4 in ENGINE_remove () from /usr/local/ssl/lib/libcrypto.so.1.1 No symbol table info available. #4 0x00007fe7179568b5 in engine_list_cleanup () from /usr/local/ssl/lib/libcrypto.so.1.1 No symbol table info available. #5 0x00007fe717955e36 in engine_cleanup_cb_free () from /usr/local/ssl/lib/libcrypto.so.1.1 No symbol table info available. #6 0x00007fe7179efaa3 in OPENSSL_sk_pop_free () from /usr/local/ssl/lib/libcrypto.so.1.1 No symbol table info available. #7 0x00007fe717956149 in engine_cleanup_int () from /usr/local/ssl/lib/libcrypto.so.1.1 No symbol table info available. #8 0x00007fe71797fa9d in OPENSSL_cleanup () from /usr/local/ssl/lib/libcrypto.so.1.1 No symbol table info available. #9 0x00007fe717260f8c in __run_exit_handlers () from /lib64/libc.so.6 No symbol table info available. #10 0x00007fe7172610c0 in exit () from /lib64/libc.so.6 No symbol table info available. #11 0x00005610b640744a in ngx_worker_process_exit (cycle=cycle@entry=0x5610b8151a00) at src/os/unix/ngx_process_cycle.c:1053 i = <optimized out> c = <optimized out> #12 0x00005610b6407f59 in ngx_worker_process_cycle (cycle=cycle@entry=0x5610b8151a00, data=data@entry=0x0) at src/os/unix/ngx_process_cycle.c:763 worker = 0 #13 0x00005610b640646b in ngx_spawn_process (cycle=cycle@entry=0x5610b8151a00, proc=proc@entry=0x5610b6407df0 <ngx_worker_process_cycle>, data=data@entry=0x0, name=name@entry=0x5610b646aa33 "worker process", respawn=respawn@entry=-3) at src/os/unix/ngx_process.c:199 on = 1 pid = 0 s = 0 #14 0x00005610b6407590 in ngx_start_worker_processes (cycle=cycle@entry=0x5610b8151a00, n=1, type=type@entry=-3) at src/os/unix/ngx_process_cycle.c:363 i = 0 ch = {command = 1, pid = 0, slot = 0, fd = 0} #15 0x00005610b640880f in ngx_master_process_cycle (cycle=0x5610b8151a00) at src/os/unix/ngx_process_cycle.c:133 title = <optimized out> p = <optimized out> size = <optimized out> i = <optimized out> n = <optimized out> sigio = <optimized out> set = {__val = {0 <repeats 16 times>}} itv = {it_interval = {tv_sec = 94629807864684, tv_usec = 0}, it_value = {tv_sec = 0, tv_usec = 0}} live = <optimized out> delay = <optimized out> ls = <optimized out> ccf = 0x5610b8153820 #16 0x00005610b63dfadc in main (argc=<optimized out>, argv=<optimized out>) at src/core/nginx.c:389 b = <optimized out> log = <optimized out> i = <optimized out> cycle = 0x5610b8151a00 init_cycle = {conf_ctx = 0x0, pool = 0x5610b8135ce0, log = 0x5610b669f560 <ngx_log>, new_log = {log_level = 0, file = 0x0, connection = 0, disk_full_time = 0, handler = 0x0, data = 0x0, writer = 0x0, wdata = 0x0, action = 0x0, next = 0x0}, log_use_stderr = 0, files = 0x0, free_connections = 0x0, free_connection_n = 0, modules = 0x0, modules_n = 0, modules_used = 0, reusable_connections_queue = {prev = 0x0, next = 0x0}, reusable_connections_n = 0, listening = {elts = 0x0, nelts = 0, size = 0, nalloc = 0, pool = 0x0}, paths = {elts = 0x0, nelts = 0, size = 0, nalloc = 0, pool = 0x0}, config_dump = {elts = 0x0, nelts = 0, size = 0, nalloc = 0, pool = 0x0}, config_dump_rbtree = {root = 0x0, sentinel = 0x0, insert = 0x0}, config_dump_sentinel = {key = 0, left = 0x0, right = 0x0, parent = 0x0, color = 0 '\000', data = 0 '\000'}, open_files = {last = 0x0, part = {elts = 0x0, nelts = 0, next = 0x0}, size = 0, nalloc = 0, pool = 0x0}, shared_memory = {last = 0x0, part = {elts = 0x0, nelts = 0, next = 0x0}, size = 0, nalloc = 0, pool = 0x0}, connection_n = 0, files_n = 0, connections = 0x0, read_events = 0x0, write_events = 0x0, async_events = 0x0, old_cycle = 0x0, conf_file = {len = 50, data = 0x7ffd57c28539 ""}, conf_param = {len = 0, data = 0x0}, conf_prefix = {len = 23, data = 0x7ffd57c28539 ""}, prefix = {len = 18, data = 0x5610b64669e1 "/usr/local/nginx//"}, lock_file = {len = 0, data = 0x0}, hostname = {len = 0, data = 0x0}, no_ssl_init = 0} cd = <optimized out> ccf = <optimized out> (gdb)
So, the bare working minimum is something like this:
ssl_engine { use_engine qatengine; }
I'm sure this must be fixed so valid configurations (without ssl_engine {} block at all) would work.
@defanator Good point, will be fixed in next release.
With the below configuration nginx worker segfaults immediately on start:
Backtrace:
With the empty ssl_engine {} block, nginx worker segfaults on exit; configuration:
Backtrace:
So, the bare working minimum is something like this:
I'm sure this must be fixed so valid configurations (without ssl_engine {} block at all) would work.