lua-resty-core icon indicating copy to clipboard operation
lua-resty-core copied to clipboard

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

Open poznir opened this issue 1 year ago • 0 comments

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:

  • [ ] The exact version of the related software, including but not limited to the OpenResty version (if any), the NGINX core version, the ngx_lua module version(via openresty -V or nginx -V), and the lua-resty-core version(via resty -e 'print(require("resty.core").version)'), and your operating system version(via uname -a).
  • [ ] A minimal and standalone test case that others can easily run on their side and reproduce the issue you are seeing.
  • [ ] Do not simply say "something is broken" or "something does not work". Always provide as much details as possible. Always describe the symptoms and your expected results.

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.

poznir avatar Jul 17 '24 07:07 poznir