Skip to content

Instantly share code, notes, and snippets.


Yichun Zhang agentzh

View GitHub Profile
View youtube-subscribe.nav
goto ""
[Button "GOT IT"]=btn1
click -> btn1
[Button "NO THANKS"]=btn0
View or-lua-module.sp
[V=browser-hello-module.mp4] Hello, I'm Matthew from OpenResty Inc. Today I'd demonstrate how to write your own Lua modules in your OpenResty applications, step by step.
Let's put our simple OpenResty application in a new directory named 'test-module'.
$ cd ~/
$ mkdir test-module/
$ cd test-module/
And then we create the sub-directory structure as always:
View hello.sp
[V=browser-hello.mp4] Hi, I'm Matthew from OpenResty Inc. In this video, I'll demonstrate how to implement a "hello world" HTTP interface using OpenResty.
First of all, we make sure we are using OpenResty's nginx.
[delay=0] $ export PATH=/usr/local/openresty/nginx/sbin:$PATH
$ which nginx
[S] It's usually in this path.
And then we go to the home directory.
View rr-staprun-errors.tx
$ sudo rr /opt/stap-plus/bin/staprun hello.ko
rr: Saving execution to trace directory `/root/.local/share/rr/staprun-0'.
[FATAL /home/agentzh/git/rr/rr/src/]
(task 26471 (rec:26471) at time 394)
-> Assertion `t->regs().syscall_result_signed() == -syscall_state.expect_errno' failed to hold. Expected ENOSYS for 'init_module' but got result 0 (errno SUCCESS); execution of syscall unsupported by rr
Tail of trace dump:
real_time:2421511.598055 global_time:374, event:`SYSCALLBUF_FLUSH' tid:26471, ticks:453980
{ syscall:'close', ret:0x0, size:0x10 }
{ syscall:'openat', ret:0x3, size:0x10 }
View fix.patch
From 100d5e81de0f34ebba38472e373dece4c3449ea4 Mon Sep 17 00:00:00 2001
From: "Yichun Zhang (agentzh)" <>
Date: Tue, 3 Mar 2020 15:15:30 -0800
Subject: [PATCH] Bug: proc_mem_rss() broken on older kernels lacking
This is a regression introduced in commit de253786000.
buildrun.cxx | 3 +++
runtime/linux/autoconf-mm-shmempages.c | 5 +++++
View s390x-luajit2-test-failures.txt
=== test/unportable/math_special.lua
Failed test when running /home/agentzh/git/luajit2-test-suite/s390x-luajit math_special.lua 1: 132
=== test/ffi/ffi_enum.lua
/opt/luajit-s390x/bin/luajit-2.1.0-beta3: ffi_enum.lua:53: too many callbacks
Failed test when running /home/agentzh/git/luajit2-test-suite/s390x-luajit ffi_enum.lua 1: 256
=== test/ffi/ffi_nosink.lua
=== test/ffi/ffi_jit_array.lua
=== test/ffi/ffi_parse_struct.lua
=== test/ffi/ffi_arith_ptr.lua
=== test/ffi/ffi_const.lua
View luajit-s390-cross-compile-failures.txt
==== Building LuaJIT 2.1.0-beta3 ====
make -C src
make[1]: Entering directory '/home/agentzh/git/luajit-2.0/src'
HOSTCC host/minilua.o
HOSTCC host/buildvm_asm.o
HOSTCC host/buildvm_peobj.o
HOSTCC host/buildvm_lib.o
HOSTCC host/buildvm_fold.o
CC lj_gc.o
CC lj_char.o
View gist:534aabb3a5bc75ff62b8fd25e3d371e0
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50 return ret;
(rr) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007f2e1be7a5b9 in __GI_abort () at abort.c:79
#2 0x00007f2e1be7a491 in __assert_fail_base (fmt=0x7f2e1bfdd048 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
assertion=0x7f2e1cb2be68 "!((((o1)->it) - ((~4u)+1)) > ((~13u) - ((~4u)+1))) || ((~((o1)->it) == (((GCobj *)(uintptr_t)((o1)->gcr).gcptr32))->gch.gct) && !(((((GCobj *)(uintptr_t)((o1)->gcr).gcptr32)))->gch.marked & ((((global"...,
file=0x7f2e1cb2be5a "lj_obj.h", line=926, function=<optimized out>) at assert.c:92
#3 0x00007f2e1be88612 in __GI___assert_fail (
View session.txt
agentzh@glass ~/git/luajit-bug-report 0 (master)$ curl http://localhost:8083/set
agentzh@glass ~/git/luajit-bug-report 0 (master)$ while true; do wrk -t4 -c120 -d10 http://localhost:8083/; sleep 0.1; done
Running 10s test @ http://localhost:8083/
4 threads and 120 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 720.03us 452.08us 22.28ms 99.06%
Req/Sec 42.77k 2.21k 58.26k 85.11%
1715219 requests in 10.10s, 294.36MB read
Requests/sec: 169825.77
View arm-luajit-test-suite-result.txt
/opt/luajit-arm/bin/luajit-2.1.0-beta3: compare.lua:226: assertion failed!
stack traceback:
[C]: in function 'assert'
compare.lua:226: in main chunk
[C]: at 0x00014cb8
=== test/misc/argcheck.lua
=== test/misc/self.lua
Failed test when running /home/agentzh/git/luajit2-test-suite/arm-luajit compare.lua 1: 256
/opt/luajit-arm/bin/luajit-2.1.0-beta3: catch_cpp.lua:2: module 'cpptest' not found: