Skip to content

Instantly share code, notes, and snippets.

View agentzh's full-sized avatar

Yichun Zhang agentzh

View GitHub Profile
@agentzh
agentzh / ngx-lua.wb
Created July 12, 2013 19:02
WalkBin sample
enum {
LUA_NOREF = -2
};
void
ngx_lua_code_cache(ngx_http_request_t *r)
{
ngx_http_lua_loc_conf_t *loc_conf;
@agentzh
agentzh / nginx.conf
Created December 12, 2013 03:42
nginx.conf for proving that access_by_lua can be used in http {} blocks
worker_processes 1;
daemon on;
master_process on;
error_log logs/error.log debug;
pid logs/nginx.pid;
http {
access_log logs/access.log;
#access_log off;
(gdb) r
Starting program: /opt/luajit21/bin/luajit-2.1.0-alpha test.lua
Program received signal SIGSEGV, Segmentation fault.
0x0000000000429a54 in lj_opt_fold (J=J@entry=0x40000558) at lj_opt_fold.c:2389
2389 key += (uint32_t)IR(fins->op2)->o;
(gdb) bt full
#0 0x0000000000429a54 in lj_opt_fold (J=J@entry=0x40000558) at lj_opt_fold.c:2389
key = 9760768
==30789== Memcheck, a memory error detector
==30789== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==30789== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==30789== Command: /opt/luajit21sysm/bin/luajit-2.1.0-alpha test.lua
==30789==
==30789== Invalid read of size 1
==30789== at 0x42E514: lj_opt_fold (lj_opt_fold.c:2389)
==30789== by 0x436A68: lj_record_idx (lj_record.c:1343)
==30789== by 0x43A14A: lj_record_ins (lj_record.c:1368)
==30789== by 0x41856A: trace_state (lj_trace.c:589)
(gdb) p $pc
$1 = (void (*)()) 0x7f73905374cc <lj_debug_funcname+204>
(gdb) disas
Dump of assembler code for function lj_debug_funcname:
0x00007f7390537400 <lj_debug_funcname+0>: mov %rbp,-0x18(%rsp)
0x00007f7390537405 <lj_debug_funcname+5>: mov %rbx,-0x20(%rsp)
0x00007f739053740a <lj_debug_funcname+10>: mov %rdi,%rbp
0x00007f739053740d <lj_debug_funcname+13>: mov %r12,-0x10(%rsp)
0x00007f7390537412 <lj_debug_funcname+18>: mov %r13,-0x8(%rsp)
0x00007f7390537417 <lj_debug_funcname+23>: sub $0x28,%rsp
location /t {
access_log off;
content_by_lua '
local mysql = require "mysql2"
local query = mysql.query
local db = {
_max_packet_size = 10240
}
local sub = string.sub
@agentzh
agentzh / gdb backtrace
Last active January 1, 2016 11:59
Assertion failure when running the sanity.t file in lua-resty-mysql's test suite with stitched LuaJIT v2.1: lj_snap.c:120: snapshot_framelinks: Assertion `f == (MSize)(1 + J->framedepth)' failed.
Program received signal SIGABRT, Aborted.
0x0000003de9e35935 in raise () from /lib64/libc.so.6
(gdb) bt full
#0 0x0000003de9e35935 in raise () from /lib64/libc.so.6
No symbol table info available.
#1 0x0000003de9e370e8 in abort () from /lib64/libc.so.6
No symbol table info available.
#2 0x0000003de9e2e6a2 in __assert_fail_base () from /lib64/libc.so.6
No symbol table info available.
#3 0x0000003de9e2e752 in __assert_fail () from /lib64/libc.so.6
@agentzh
agentzh / gdb backtrace
Created December 27, 2013 02:30
Assertion failure when running the exit.t file in lua-resty-core's test suite with stitched LuaJIT v2.1: lj_snap.c:120: snapshot_framelinks: Assertion `f == (MSize)(1 + J->framedepth)' failed.
Program received signal SIGABRT, Aborted.
0x0000003de9e35935 in raise () from /lib64/libc.so.6
(gdb) bt full
#0 0x0000003de9e35935 in raise () from /lib64/libc.so.6
No symbol table info available.
#1 0x0000003de9e370e8 in abort () from /lib64/libc.so.6
No symbol table info available.
#2 0x0000003de9e2e6a2 in __assert_fail_base () from /lib64/libc.so.6
No symbol table info available.
#3 0x0000003de9e2e752 in __assert_fail () from /lib64/libc.so.6
@agentzh
agentzh / gdb backtrace
Created December 27, 2013 02:45
segfault when running the t/exit.t test file in lua-resty-core's test suite with the latest "stitched" LuaJIT v2.1
Program received signal SIGSEGV, Segmentation fault.
0x00007f1ee1c3454a in gc_traverse_frames (g=0x41c4e3b8, th=0x413e4848) at lj_gc.c:274
274 if (isluafunc(fn)) ftop += funcproto(fn)->framesize;
(gdb) bt
#0 0x00007f1ee1c3454a in gc_traverse_frames (g=0x41c4e3b8, th=0x413e4848) at lj_gc.c:274
#1 0x00007f1ee1c34777 in gc_traverse_thread (g=0x41c4e3b8, th=0x413e4848) at lj_gc.c:295
#2 0x00007f1ee1c34960 in propagatemark (g=0x41c4e3b8) at lj_gc.c:326
#3 0x00007f1ee1c3565d in gc_onestep (L=0x413e4d78) at lj_gc.c:606
#4 0x00007f1ee1c35983 in lj_gc_step (L=0x413e4d78) at lj_gc.c:679
#5 0x00007f1ee1c49855 in lua_createtable (L=0x413e4d78, narray=0, nrec=1) at lj_api.c:643
@agentzh
agentzh / gdb backtrace
Created December 27, 2013 02:47
segfault when running the t/sanity.t test file in lua-resty-mysql's test suite with the latest "stitched" LuaJIT v2.1.
Program received signal SIGSEGV, Segmentation fault.
0x00007fbe8d2e3120 in lj_BC_RET () from /opt/luajit21/lib/libluajit-5.1.so.2
(gdb) bt
#0 0x00007fbe8d2e3120 in lj_BC_RET () from /opt/luajit21/lib/libluajit-5.1.so.2
#1 0x00007fbe8d2fdd40 in lua_resume (L=0x40b662e8, nargs=1) at lj_api.c:1123