iresty / lua-resty-libr3

High-performance path dispatching library base on libr3 for OpenResty
Apache License 2.0
57 stars 9 forks source link

bug: fail to run the test case in Ubuntu. #13

Closed membphis closed 5 years ago

membphis commented 5 years ago

https://github.com/iresty/lua-resty-libr3/blob/master/t/collectgarbage.t

membphis commented 5 years ago

if we use the OpenResty source package and compile it, it works fine.

it should be a bug with OpenResty package of Ubuntu, and it should be related to the openresty-pcre package.

here is some error message:

rain@ubuntu:~/lua-resty-libr3$ gdb /usr/local/openresty/nginx/sbin/nginx /tmp/cores/core
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/openresty/nginx/sbin/nginx...Reading symbols from /usr/lib/debug/.build-id/0a/7381c468b2348285fdb9f363042c5709937021.debug...done.
done.
[New LWP 25799]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `nginx: worker process                          '.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  _pcre_jit_free (executable_funcs=0x77) at pcre_jit_compile.c:11753
11753   pcre_jit_compile.c: No such file or directory.
(gdb) bt
#0  _pcre_jit_free (executable_funcs=0x77) at pcre_jit_compile.c:11753
#1  0x00007fe24767eddc in pcre_free_study (extra=0x1a285e0) at pcre_study.c:1681
#2  0x00007fe2465271b9 in r3_tree_free (tree=0x1a23c70) at node.c:80
#3  0x00007fe247bb3e76 in lj_vm_ffi_call () at buildvm_x86.dasc:2811
#4  0x00007fe247bf776e in lj_ccall_func (L=L@entry=0x7fe2486135a8, cd=<optimized out>) at lj_ccall.c:1161
#5  0x00007fe247c0c927 in lj_cf_ffi_meta___call (L=0x7fe2486135a8) at lib_ffi.c:230
#6  0x00007fe247bb18a5 in lj_BC_FUNCC () at buildvm_x86.dasc:898
#7  0x00007fe247bb3fe1 in gc_call_finalizer (g=g@entry=0x7fe2486073e0, L=L@entry=0x7fe2486135a8,
    mo=<optimized out>, o=o@entry=0x7fe2485ddd10) at lj_gc.c:475
#8  0x00007fe247bb40bf in gc_finalize (L=0x7fe2486135a8) at lj_gc.c:521
#9  0x00007fe247bb4c2c in gc_onestep (L=L@entry=0x7fe2486135a8) at lj_gc.c:659
#10 0x00007fe247bb54b8 in lj_gc_fullgc (L=0x7fe2486135a8) at lj_gc.c:748
#11 0x00007fe247bc3e65 in lua_gc (L=L@entry=0x7fe2486135a8, what=what@entry=2, data=<optimized out>)
    at lj_api.c:1244
#12 0x00007fe247c01af4 in lj_cf_collectgarbage (L=0x7fe2486135a8) at lib_base.c:454
#13 0x00007fe247bb18a5 in lj_BC_FUNCC () at buildvm_x86.dasc:898
#14 0x00000000004fbd82 in ngx_http_lua_run_thread (L=L@entry=0x7fe248607378, r=r@entry=0x1a28250,
    ctx=ctx@entry=0x1a28ff0, nrets=nrets@entry=0) at ../ngx_lua-0.10.15/src/ngx_http_lua_util.c:1091
#15 0x00000000004fefb7 in ngx_http_lua_content_by_chunk (L=0x7fe248607378, r=0x1a28250)
    at ../ngx_lua-0.10.15/src/ngx_http_lua_contentby.c:122
#16 0x00000000004feb9c in ngx_http_lua_content_handler (r=0x1a28250)
    at ../ngx_lua-0.10.15/src/ngx_http_lua_contentby.c:224
#17 0x000000000045c8ae in ngx_http_core_content_phase (r=0x1a28250, ph=<optimized out>)
    at src/http/ngx_http_core_module.c:1180
#18 0x0000000000457115 in ngx_http_core_run_phases (r=0x1a28250) at src/http/ngx_http_core_module.c:869
#19 0x0000000000462211 in ngx_http_process_request_headers (rev=rev@entry=0x1a29710)
    at src/http/ngx_http_request.c:1381
#20 0x0000000000462587 in ngx_http_process_request_line (rev=0x1a29710) at src/http/ngx_http_request.c:1051
#21 0x000000000044b36b in ngx_epoll_process_events (cycle=<optimized out>, timer=<optimized out>,
    flags=<optimized out>) at src/event/modules/ngx_epoll_module.c:902
#22 0x0000000000441cfb in ngx_process_events_and_timers (cycle=cycle@entry=0x19fb1c0) at src/event/ngx_event.c:252
#23 0x0000000000449702 in ngx_worker_process_cycle (cycle=0x19fb1c0, data=<optimized out>)
    at src/os/unix/ngx_process_cycle.c:816
#24 0x0000000000447c4c in ngx_spawn_process (cycle=cycle@entry=0x19fb1c0,
    proc=proc@entry=0x449690 <ngx_worker_process_cycle>, data=data@entry=0x0,
    name=name@entry=0x558e59 "worker process", respawn=respawn@entry=-4) at src/os/unix/ngx_process.c:199
#25 0x0000000000448e04 in ngx_start_worker_processes (cycle=cycle@entry=0x19fb1c0, n=1, type=type@entry=-4)
    at src/os/unix/ngx_process_cycle.c:397
#26 0x000000000044a2d4 in ngx_master_process_cycle (cycle=0x19fb1c0, cycle@entry=0x19f71b0)
    at src/os/unix/ngx_process_cycle.c:251
#27 0x0000000000421984 in main (argc=<optimized out>, argv=<optimized out>) at src/core/nginx.c:382
(gdb) quit
membphis commented 5 years ago

fixed already, the lua string object can not be freed before r3 object freed.