openresty-systemtap-toolkit icon indicating copy to clipboard operation
openresty-systemtap-toolkit copied to clipboard

ngx-sample-lua-bt fails to figure out lua_path

Open zharan opened this issue 10 years ago • 3 comments

Hi,

I'm using the latest version of nginx-systemtap-toolkit under Ubuntu 14.04.1 LTS (server type) for optimizing performance of Lua code running on Nginx (built with lua-nginx-module). I tried to run ngx-sample-lua-bt script, but it exited with the following problem:

semantic error: while resolving probe point: identifier 'process' at <input>:12:7
        source: probe process("/home/andriy/nginx-1.7.6/objs/nginx").function ("lua_resume"),
                         ^
semantic error: no match (similar functions: lua_resume, lua_remove, lua_replace, luaL_gsub, luaL_ref)

To me it looked like code inside ngx-sample-lua-bt script couldn't figure out value for the lua_path variable by parsing contents of /proc/[pid]/maps. I did a quick hack:

if (!defined $lua_path) {
    #warn "FALL BACK TO NGINX PATH";
    #$lua_path = $nginx_path;
    $lua_path = "/usr/lib/x86_64-linux-gnu/liblua5.1.so.0.0.0";
}

And after that ngx-sample-lua-bt stopped failing. What should be a proper fix for that problem?

zharan avatar Oct 27 '14 20:10 zharan

@zharan Thank you for the report! Just committed a fix the git master. Will you try it out?

BTW, it's recommended to use LuaJIT 2 for maximal performance :)

agentzh avatar Oct 27 '14 20:10 agentzh

The fix helped, thanks! Yeah, I'll definitely try out LuaJIT 2, thanks for advice.

zharan avatar Oct 27 '14 20:10 zharan

Oh, I probably bumbed into the problem described in this issue, because I didn't create this symlink:

ln -s /usr/lib/x86_64-linux-gnu/liblua5.1.so /usr/lib/liblua.so

as it was described in https://github.com/openresty/lua-nginx-module/#installation-on-ubuntu-1110.

zharan avatar Oct 28 '14 21:10 zharan