Lua pcre inside nginx

I wanted to use pcre inside a lua script using rex_pcre. However, I
always
get the error:

failed to get memory (pattern offset: 15)

The snippet of code always works in a standalone script.

Ideas?


Brian A.

Hi,

On 04/05/2011 22:03, Akins, Brian wrote:

I wanted to use pcre inside a lua script using rex_pcre. However, I always
get the error:

failed to get memory (pattern offset: 15)

The snippet of code always works in a standalone script.

Ideas?
I just tried the supplied test suite for rex_pcre on the latest (as of a
few days ago) trunk version of LuaJIT 2.0 on Nginx 1.0.0 and there were
no test failures. Maybe try JIT if you’re not using it already?

Cheers,

Marcus.

On 5/4/11 5:37 PM, “Eugaia” [email protected] wrote:

I just tried the supplied test suite for rex_pcre on the latest (as of a
few days ago) trunk version of LuaJIT 2.0 on Nginx 1.0.0 and there were
no test failures. Maybe try JIT if you’re not using it already?

I already am using luajit. I was using rex_pcre from luarocks.


Brian A.

On 5/4/11 5:39 PM, “Brian A.” [email protected] wrote:

I already am using luajit. I was using rex_pcre from luarocks.

I grabbed latest rex_pcre, same issue. This is x86_64 if that matters.


Brian A.

On 5/4/11 11:36 PM, “Chaos Wang” [email protected] wrote:

ngx_lua has fixed this problem, and can use pcre related extensions
normally after v0.1.6rc5.

Thanks. Seems to work now.


Brian A.

NginX hooked pcre memory alloc/free functions pcre_malloc/free to use
its memory pool, in order to work around its memory leaking problem. As
a side effect, it reset this pool to NULL after every usage in core
without considering possible external references. If you don’t set pcre
memory hooks to your own implementation, you will surely get the error.

ngx_lua has fixed this problem, and can use pcre related extensions
normally after v0.1.6rc5.

Ref:

  • src/core/ngx_regex.c in NginX sources
  • ngx_http_lua_patch.c in ngx_lua sources

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs