openresty / lua-resty-core

New FFI-based API for lua-nginx-module
811 stars 272 forks source link

when using ngx.exit(5**), the ngx.ctx is empty at the log_by_lua_block phase #480

Open poznir opened 4 months ago

poznir commented 4 months ago

i'm trying to run ngx.exit(500) at my request handling code (location under server section of nginx) and tried to add some code handling the log phase, log_by_lua_block { require("final").run() } and in the code i'm trying to access variable i set in ngx.ctx but i found out that when i exit with 5 the ctx will be empty. when i exit with 4 or 2** it's there as expected.

nginx version: openresty/1.25.3.1 built by gcc 7.3.1 20180712 (Red Hat 7.3.1-17) (GCC) built with OpenSSL 1.0.2k-fips 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.3 --add-module=../echo-nginx-module-0.63 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2 --add-module=../set-misc-nginx-module-0.33 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.09 --add-module=../srcache-nginx-module-0.33 --add-module=../ngx_lua-0.10.26 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.37 --add-module=../array-var-nginx-module-0.06 --add-module=../memc-nginx-module-0.20 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.9 --add-module=../rds-json-nginx-module-0.16 --add-module=../rds-csv-nginx-module-0.09 --add-module=../ngx_stream_lua-0.0.14 --with-ld-opt=-Wl,-rpath,/usr/local/openresty/luajit/lib --with-pcre-jit --with-ipv6 --with-stream --without-pcre2 --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_ssl_module

This place is for bug reports and development discussions only. For general questions and discussions, please join the openresty-en mailing list instead: https://groups.google.com/group/openresty-en. If you want to use Chinese, please join the openresty (Chinese) mailing list instead: https://groups.google.com/group/openresty. Do not use Chinese in this place.

Before you open a new issue, please search the internet and make sure it is not duplicate.

Ensure you have provided the following details while reporting a problem:

You can (temporarily) enable the nginx debugging logs to see the internal workings of NGINX in your nginx''s error.log file. See http://nginx.org/en/docs/debugging_log.html The same instructions apply equally well to OpenResty.

If you are seeing crashes, please provide the full backtrace for the crash. See https://www.nginx.com/resources/wiki/start/topics/tutorials/debugging/#core-dump for more details.

Thanks for your cooperation.