Code Monkey home page Code Monkey logo

Comments (10)

rshriram avatar rshriram commented on July 28, 2024

Flamegraph points to pcre_exec instead of pcre_jit_exec.
image

from lua-resty-core.

agentzh avatar agentzh commented on July 28, 2024

Have you specified the "jo" options string when calling the ngx.re.* API functions?

from lua-resty-core.

rshriram avatar rshriram commented on July 28, 2024

"j" is new to me. So, I tried with "jo". I can now see pcre_jit_exec in the flame graphs.
But the ngx-pcrejit is still reporting that none of the regexps were jit compiled.
I still get the same output saying looks like pcre jit is not enabled.

I also verified that the pcre Makefile has the -g flag.

from lua-resty-core.

agentzh avatar agentzh commented on July 28, 2024

@rshriram Try enabling the debug logs temporarily in OpenResty and see if the PCRE JIT compilation just fails for some reason.

from lua-resty-core.

agentzh avatar agentzh commented on July 28, 2024

@rshriram Just re-compile with --with-debug and configure error_log logs/error.log debug; in your nginx.conf.

BTW, it would be much easier when the official OpenResty deb packages for Ubuntu are ready (which should be out soon). Then you can just install the openresty-debug package via apt get and start openresty-debug to run your OpenResty applications.

from lua-resty-core.

agentzh avatar agentzh commented on July 28, 2024

@rshriram Oh, BTW, your ngx-pcrejit tool reports that it is tracing the /usr/sbin/nginx process. Is that truly OpenResty's nginx? I know nothing about the openresty-docker image BTW.

from lua-resty-core.

agentzh avatar agentzh commented on July 28, 2024

@rshriram Because you are seeing pcre_jit_exec in the flame graphs, it means that your PCRE JIT compilation already succeeds. Maybe it's just that ngx-pcrejit does not work with recent versions of PCRE any more. It was created a while ago.

from lua-resty-core.

agentzh avatar agentzh commented on July 28, 2024

@rshriram I just tried the latest PCRE 8.39 on my side with OpenResty. And ngx-pcrejit works properly on the following nginx.conf snippet:

    location ~ '^/t' {
        content_by_lua_block {
            ngx.say(ngx.re.find(ngx.var.uri, [[\w]], "jo"))
        }
    }

Running curl localhost:8080/t twice while the ngx-pcrejit tool is tracing the only nginx worker yields the following output:

$ ./ngx-pcrejit -p `pgrep -f 'nginx: worker'`
Tracing 97156 (/home/agentzh/git/lua-nginx-module/work/nginx/sbin/nginx)...
Hit Ctrl-C to end.
WARNING: Missing unwind data for a module, rerun with 'stap -d /usr/lib64/libc-2.21.so'
WARNING: Missing unwind data for a module, rerun with 'stap -d /opt/luajit21dbg/lib/libluajit-5.1.so.2.1.0'
^C
ngx_http_regex_exec: 2 of 2 are PCRE JITted.
ngx_http_lua_ngx_re_match_helper: 2 of 2 are PCRE JITted.

All work as expected. You can try your example on your side.

BTW, below is my Linux system's info:

  • Linux kernel 4.4.13
  • Systemtap translator/driver (version 3.1/0.161, commit release-3.0-104-gbedfbdce0989 + changes)
  • Fedora release 22 (Twenty Two)

from lua-resty-core.

agentzh avatar agentzh commented on July 28, 2024

@rshriram BTW, such things should go to the nginx-systemtap-tookit project instead.

from lua-resty-core.

rshriram avatar rshriram commented on July 28, 2024

This is weird.. Granted, I have an older kernel (3.16). But I don't understand why things are not working on Ubuntu 14.04. May be its related to this bug in Launchpad where someone reported that PCRE jit was not really enabled. https://bugs.launchpad.net/ubuntu/+source/pcre3/+bug/1285097

I don't think it applies in this case because PCRE is statically compiled into the app. Will investigate more.

Thanks!

from lua-resty-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.