Skip to content

The Call stack of ngx.re change #491

Description

@liukaiyuliukaiyu

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

Activity

  1. liukaiyuliukaiyu commented on Dec 12, 2024

    @liukaiyuliukaiyu
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions