openresty / openresty/lua-resty-core
when using ngx.exit(5**), the ngx.ctx is empty at the log_by_lua_block phase
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 853
- Forks
- 286
- Avg merge
- 35m
- Merged PRs (30d)
- 1
Description
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, thengx_luamodule version(viaopenresty -Vornginx -V),
and thelua-resty-coreversion(viaresty -e 'print(require("resty.core").version)'),
and your operating system version(viauname -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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by building the missing minimal standalone test case around ngx.exit(500), ngx.ctx, and the log_by_lua_block requiring final.run(), then compare it with 4xx and 2xx exits. Confirm the behavior using the reported OpenResty and ngx_lua versions, and record the expected versus observed ngx.ctx contents in the log phase.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, nginx
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100