Hello!
On Fri, Nov 13, 2015 at 2:11 PM, 伟辰李 wrote:
> I have met a problem while using lrexlib-pcre in nginx context.
>
> I've called rex_pre.new in init_by_lua_file script and called rex_pcre.match
> in access_by_lua_file script, but I got following error message every time:
>
> 550 2015/11/10 11:21:34 [error] 28259#0: *154 lua entry thread aborted:
> runtime error:###########/siglib.lua:31: error PCRE_ERROR_BADMAGIC
>
Right, this is expected. Lua libraries using PCRE are not allowed in
the ngx_lua context since the NGINX core hijacks the PCRE allocator
itself. Fortunately, ngx_lua provides its own PCRE binding via the
ngx.re API, which plays nicely with the NGINX core. You should use
that instead.
BTW, if you don't want to use ngx_lua's ngx.re API, you can find (or
write) a Lua binding to the new PCRE2 library which does not have this
limitation.
Regards,
-agentzh