This looks like the segfault is coming from a third party module (ngx_aws_auth). Best to contact the author of the module to have them take a look.
I see that you've previously mentioned that ngx.timer.at is not supported in init_by_lua. That leaves me to using the init_worker_by_lua block.
This is where I am getting the core dump problem.
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
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)
On Saturday, November 11, 2017 at 7:39:48 PM UTC-8, bra...@ rabb.it wrote: I'm terribly sorry for having such dumb questions here.
[alert] 1#1: lua_code_cache is off; this will hurt performance in /nginx.conf:106 Nov 12 03:36:03 dockerd[1968]: nginx: [alert] lua_code_cache is off; this will hurt performance in /nginx.conf:106 Nov 12 03:36:03 dockerd[1968]: 2017/11/12 03:36:03 [error] 1#1: init_by_lua error: init_by_lua:23: no request Nov 12 03:36:03 dockerd[1968]: stack traceback: Nov 12 03:36:03 dockerd[1968]: [C]: in function 'at' Nov 12 03:36:03 dockerd[1968]: init_by_lua:23: in main chunk Nov 12 03:36:03 dockerd[1968]: nginx: [error] init_by_lua error: init_by_lua:23: no request Nov 12 03:36:03 dockerd[1968]: stack traceback: Nov 12 03:36:03 dockerd[1968]: [C]: in function 'at' Nov 12 03:36:03 dockerd[1968]: init_by_lua:23: in main chunk
http { lua_socket_pool_size 100; lua_socket_connect_timeout 10ms; lua_socket_read_timeout 10ms; lua_package_path '/data/bunstributor/include.d/lua-resty-s3/libs/?.lua;;';
lua_shared_dict bunstributor_mapping 10m;
init_by_lua_block {
local cjson = require("cjson") local awss3 = require "resty.s3" local delay = 5 local handler handler = function (premature) -- do some routine job in Lua just like a cron job local s3 = awss3:new(key, secret, "bunstributor", {timeout=1000*10}) local ok, response = s3:get("/test1/bunstributor_mapping.txt") local succ, err, forcible = bunstributor_mapping.set(bunstributor_mapping, cjson.decode(response))
if premature then return end
if not ok then ngx.log(ngx.ERR, "failed to create the timer: ", err) return end end
local ok, err = ngx.timer.at(delay, handler)
if not ok then ngx.log(ngx.ERR, "failed to create the timer: ", err) return end } }
On Saturday, November 11, 2017 at 1:27:47 PM UTC-8, agentzh wrote: Hello!
On Fri, Nov 10, 2017 at 9:29 PM, <bra...@rabb.it> wrote:
> --broken code from below in init_by_lua
>
> init_by_lua error:
> ...nstributor/include.d/lua-resty-s3/libs/resty/s3_auth.lua:14: no request
> object found
>
init_by_lua* runs in the nginx master process while cosockets cannot
run in that context (yet).
>
> --broken code from below in init_worker_by_lua
> Nov 11 05:14:16 server.dockerd[1968]: 2017/11/11 05:14:16 [alert] 1#1:
> cache manager process 50 exited on signal 11 (core dumped)
> Nov 11 05:14:16 server.dockerd[1968]: 2017/11/11 05:14:16 [alert] 1#1:
> worker process 51 exited on signal 11 (core dumped)
>
I need the full backtrace from the gdb command "bt full" when
inspecting these core dumps. See
https://www.nginx.com/resources/admin-guide/debug/#backtrace
for more details.
BTW, please make sure you use the latest OpenResty release. See
https://openresty.org/en/download.html
>
>
> --broken code
>
> init_worker_by_lua_block {
>
> local cjson = require("cjson")
> local awss3 = require "resty.s3"
>
>
> local s3 = awss3:new("key", "secret", "bunstributor", {timeout=1000*10})
> }
You need to run the cosocket code in a timer handler (created by
ngx.timer.at or ngx.timer.every). The cosocket API is disabled in the
init_worker_by_lua* itself as well (just like init_by_lua*). But it's
available in the timer handler.
Please read the official documentation more carefully.
Regards,
Yichun
.
|