anomalizer / ngx_aws_auth

nginx module to proxy to authenticated AWS services
BSD 2-Clause "Simplified" License
470 stars 144 forks source link

Causes a seg fault if an init_worker_by_lua block is present #50

Open bpinske opened 6 years ago

bpinske commented 6 years ago

If any init_worker_by_lua block is present at all in my config, my worker processes core dump immediately. Below is the gdb trace of my core dump, version of resty and an example of the code triggering the problem. I have not been able to reproduce this problem in any other *_by_lua block.

dockerd[1968]: 2017/11/12 23:08:10 [alert] 1#1: worker process 29 exited on signal 11 (core dumped)

init_worker_by_lua '
  local function hi(premature)
    ngx.log(ngx.ERR, "hi")
  end   ngx.timer.at(0, hi)
';
/usr/local/openresty/bin/openresty -V
nginx version: openresty/1.11.2.5
built by gcc 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.5)
built with OpenSSL 1.0.2k  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt=-O2 --add-module=../ngx_devel_kit-0.3.0 --add-module=../echo-nginx-module-0.61 --add-module=../xss-nginx-module-0.05 --add-module=../ngx_coolkit-0.2rc3 --add-module=../set-misc-nginx-module-0.31 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.06 --add-module=../srcache-nginx-module-0.31--add-module=../ngx_lua-0.10.10 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.32 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.18 --add-module=../redis2-nginx-module-0.14 --add-module=../redis-nginx-module-0.3.7 --add-module=../rds-json-nginx-module-0.14 --add-module=../rds-csv-nginx-module-0.07 --with-ld-opt=-Wl,-rpath,/usr/local/openresty/luajit/lib --with-openssl=/tmp/openssl-1.0.2k --with-pcre=/tmp/pcre-8.40 --add-module=/tmp/openresty-1.11.2.5/ngx_aws_auth --with-file-aio --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_module=dynamic --with-ipv6 --with-mail --with-mail_ssl_module --with-md5-asm --with-pcre-jit --with-sha1-asm --with-stream --with-stream_ssl_module --with-threads

dockerd[1968]: 2017/11/12 23:08:10 [alert] 1#1: worker process 29 exited on signal 11 (core dumped)

GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/openresty/bin/openresty...done.

warning: core file may not match specified executable file.
[New LWP 78]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `nginx: master process /usr/local/openresty/bin/openresty -c /ngin'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  ngx_http_add_variable (cf=cf@entry=0x7ffe5328a9a0,
    name=name@entry=0x9ec160 <ngx_http_aws_auth_vars>, flags=1)
    at src/http/ngx_http_variables.c:387
387 src/http/ngx_http_variables.c: No such file or directory.
(gdb)