Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Call stack of ngx.re change #491

Open
liukaiyuliukaiyu opened this issue Dec 12, 2024 · 1 comment
Open

The Call stack of ngx.re change #491

liukaiyuliukaiyu opened this issue Dec 12, 2024 · 1 comment

Comments

@liukaiyuliukaiyu
Copy link

The original ngx.re call link was ngx.re.find -->lua-nginx-module --> ngx_http_lua_ngx_re_find --> ngx_http_lua_ngx_re_match_helper
When compiling openresty, add the compile parameter --with-ld-opt /curl/lib/ -lcurl curl
The /lib/ directory contains the following files: libcurl.a libcurl.la libcurl.so libcurl.so.4 libcurl.so.4.3.0
./configure \ --prefix=/usr/local/openresty \ --with-ld-opt="-Wl,-rpath,/usr/local/openresty/luajit/lib \ -L/*/curl/lib/ -lcurl"
Then the function call stack for ngx.re.find becomes
ngx.re.find() --> re_match_helper -->ngx_lua_ffi_exec_regex -->ngx_http_lua_ffi_exec_regex
ngx.re.find() in regex.lua that calls lua-resty-core.
Why is that? Why does curllib affect the underlying call logic?
Help, thank you very much

@liukaiyuliukaiyu
Copy link
Author

local func = ngx.re.find
local info = debug.getinfo(func)
ngx.log(ngx.ERR, "Function source: ", info.source)
ngx.log(ngx.ERR, "Defined at line: ", info.linedefined)

2024/12/12 17:37:24 [error] 1932901#1932901: *2578324 [lua] router.lua:565: find_api(): Function source: =[C], client: 10.34.55.32, server: baidu, request: "GET /dialing-test HTTP/1.1", host: "xxxx"
2024/12/12 17:37:24 [error] 1932901#1932901: *2578324 [lua] router.lua:566: find_api(): Defined at line: -1, client: 10.34.55.32, server:baidu, request: "GET /dialing-test HTTP/1.1", host: "xxxx"

logs after adding compile parameters:
2024/12/12 16:59:41 [error] 678167#678167: *3892 [lua] router.lua:564: find_api(): Function source: @/usr/local/openresty/lualib/resty/core/regex.lua, client: 10.71.185.21, server: baidu, request: "GET /dialing-test HTTP/1.1", host: "xxxxx"
2024/12/12 16:59:41 [error] 678167#678167: *3892 [lua] router.lua:565: find_api(): Defined at line: 713, client: 10.71.185.21, server: baidu, request: "GET /dialing-test HTTP/1.1", host: "xxxxx"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant