This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function factory() | |
local f = function () | |
local function func1() | |
return error([[blah]]) | |
end | |
local function func2() | |
local v = func1() | |
return v | |
end | |
local function func3() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location = /cjson { | |
content_by_lua ' | |
local json = require "cjson.safe" | |
ngx.say("cjson.safe: ", json.encode{foo = 123}) | |
'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ strace -p 22507 -s 1024 | |
Process 22507 attached | |
write(4, "2014/03/07 13:52:43 [info] 22507#0: epoll_wait() failed (4: Interrupted system call)\n", 85) = 85 | |
epoll_wait(3, {?} 0xd122b0, 512, -1) = 1 | |
accept4(6, {sa_family=AF_INET, sin_port=htons(57726), sin_addr=inet_addr("127.0.0.1")}, [16], SOCK_NONBLOCK) = 7 | |
epoll_ctl(3, EPOLL_CTL_ADD, 7, {...}) = 0 | |
epoll_wait(3, {?} 0xd122b0, 512, 60000) = 1 | |
recvfrom(7, "GET /t HTTP/1.1\r\nUser-Agent: curl/7.24.0 (x86_64-redhat-linux-gnu) libcurl/7.24.0 NSS/3.14.3.0 zlib/1.2.5 libidn/1.24 libssh2/1.4.1\r\nHost: localhost:8080\r\nAccept: */*\r\n\r\n", 1024, 0, NULL, NULL) = 170 | |
write(4, "2014/03/07 13:52:45 [notice] 22507#0: *3 [lua] [string \"content_by_lua\"]:2: hi, client: 127.0.0.1, server: localhost, request: \"GET /t HTTP/1.1\", host: \"localhost:8080\"\n", 169) = 169 | |
write(2, "today is Friday, in March (03/07/14)\n", 37) = 37 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ngx-lua-exec-time.sxx -x 14884 | |
Start tracing process 14884 (/home/agentzh/git/lua-nginx-module/work/nginx/sbin/nginx)... | |
Hit Ctrl-C to end. | |
^C | |
Distribution of Lua code pure execution time (accumulated in each request, in microseconds) for 10000 samples: | |
(min/avg/max: 4/6/65) | |
value |-------------------------------------------------- count | |
1 | 0 | |
2 | 0 | |
4 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9204 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location /t { | |
access_log off; | |
content_by_lua ' | |
local redis = require "resty.redis" | |
local red = redis:new() | |
red:set_timeout(1000) -- 1 sec | |
local ok, err = red:connect("127.0.0.1", $TEST_NGINX_REDIS_PORT) | |
if not ok then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/lj_def.h b/src/lj_def.h | |
index 3c43be7..4d06d18 100644 | |
--- a/src/lj_def.h | |
+++ b/src/lj_def.h | |
@@ -72,7 +72,7 @@ typedef unsigned int uintptr_t; | |
/* Minimum table/buffer sizes. */ | |
#define LJ_MIN_GLOBAL 6 /* Min. global table size (hbits). */ | |
#define LJ_MIN_REGISTRY 2 /* Min. registry size (hbits). */ | |
-#define LJ_MIN_STRTAB 256 /* Min. string table size (pow2). */ | |
+#define LJ_MIN_STRTAB 4096 /* Min. string table size (pow2). */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/opt/luajit21dbg/bin/luajit-2.1.0-alpha -e 'function f() xpcall(function () return a + 1 end, function () return coroutine.yi | |
eld() end) end c = coroutine.create(f) coroutine.resume(c)' | |
diff --git a/src/lib_base.c b/src/lib_base.c | |
index 713bdae..db6e345 100644 | |
--- a/src/lib_base.c | |
+++ b/src/lib_base.c | |
@@ -567,6 +567,7 @@ LJLIB_CF(coroutine_create) | |
LJLIB_ASM(coroutine_yield) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- A Lua implementation of the Aho-Corasick string matching algorithm | |
-- | |
-- Copyright (c) 2013 CloudFlare, Inc. | |
-- | |
-- Usage: | |
-- | |
-- local AC = require 'aho-corasick' | |
-- | |
-- t = AC.build({'words', 'to', 'find'}) | |
-- r = AC.match(t, 'try to find in this string') |
-
hello world
abc ```
- hello baby
OlderNewer