feature: added nginx configuration file names and line numbers to the rewrite/access/content/log_by_lua directives' Lua chunk names in order to simplify debugging.

This commit is contained in:
Yichun Zhang (agentzh) 2014-11-11 21:19:32 -08:00
Родитель e226845119
Коммит e6132eab93
27 изменённых файлов: 296 добавлений и 168 удалений

Просмотреть файл

@ -179,7 +179,7 @@ ngx_http_lua_access_handler_inline(ngx_http_request_t *r)
rc = ngx_http_lua_cache_loadbuffer(r, L, llcf->access_src.value.data,
llcf->access_src.value.len,
llcf->access_src_key,
"=access_by_lua");
(const char *) llcf->access_chunkname);
if (rc != NGX_OK) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;

Просмотреть файл

@ -189,18 +189,21 @@ typedef struct {
ngx_http_output_body_filter_pt body_filter_handler;
u_char *rewrite_chunkname;
ngx_http_complex_value_t rewrite_src; /* rewrite_by_lua
inline script/script
file path */
u_char *rewrite_src_key; /* cached key for rewrite_src */
u_char *access_chunkname;
ngx_http_complex_value_t access_src; /* access_by_lua
inline script/script
file path */
u_char *access_src_key; /* cached key for access_src */
u_char *content_chunkname;
ngx_http_complex_value_t content_src; /* content_by_lua
inline script/script
file path */
@ -208,6 +211,7 @@ typedef struct {
u_char *content_src_key; /* cached key for content_src */
u_char *log_chunkname;
ngx_http_complex_value_t log_src; /* log_by_lua inline script/script
file path */

Просмотреть файл

@ -283,7 +283,8 @@ ngx_http_lua_content_handler_inline(ngx_http_request_t *r)
rc = ngx_http_lua_cache_loadbuffer(r, L, llcf->content_src.value.data,
llcf->content_src.value.len,
llcf->content_src_key,
"=content_by_lua");
(const char *)
llcf->content_chunkname);
if (rc != NGX_OK) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}

Просмотреть файл

@ -33,6 +33,9 @@
static ngx_int_t ngx_http_lua_set_by_lua_init(ngx_http_request_t *r);
#endif
static u_char * ngx_http_lua_gen_chunk_name(ngx_conf_t *cf, const char *tag,
size_t tag_len);
char *
ngx_http_lua_shared_dict(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
@ -372,7 +375,7 @@ ngx_http_lua_filter_set_by_lua_file(ngx_http_request_t *r, ngx_str_t *val,
char *
ngx_http_lua_rewrite_by_lua(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
u_char *p;
u_char *p, *chunkname;
ngx_str_t *value;
ngx_http_lua_main_conf_t *lmcf;
ngx_http_lua_loc_conf_t *llcf = conf;
@ -405,7 +408,16 @@ ngx_http_lua_rewrite_by_lua(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
if (cmd->post == ngx_http_lua_rewrite_handler_inline) {
chunkname = ngx_http_lua_gen_chunk_name(cf, "rewrite_by_lua",
sizeof("rewrite_by_lua") - 1);
if (chunkname == NULL) {
return NGX_CONF_ERROR;
}
llcf->rewrite_chunkname = chunkname;
/* Don't eval nginx variables for inline lua code */
llcf->rewrite_src.value = value[1];
p = ngx_palloc(cf->pool, NGX_HTTP_LUA_INLINE_KEY_LEN + 1);
@ -458,7 +470,7 @@ ngx_http_lua_rewrite_by_lua(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
char *
ngx_http_lua_access_by_lua(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
u_char *p;
u_char *p, *chunkname;
ngx_str_t *value;
ngx_http_lua_main_conf_t *lmcf;
ngx_http_lua_loc_conf_t *llcf = conf;
@ -487,7 +499,16 @@ ngx_http_lua_access_by_lua(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
if (cmd->post == ngx_http_lua_access_handler_inline) {
chunkname = ngx_http_lua_gen_chunk_name(cf, "access_by_lua",
sizeof("access_by_lua") - 1);
if (chunkname == NULL) {
return NGX_CONF_ERROR;
}
llcf->access_chunkname = chunkname;
/* Don't eval nginx variables for inline lua code */
llcf->access_src.value = value[1];
p = ngx_palloc(cf->pool, NGX_HTTP_LUA_INLINE_KEY_LEN + 1);
@ -541,6 +562,7 @@ char *
ngx_http_lua_content_by_lua(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
u_char *p;
u_char *chunkname;
ngx_str_t *value;
ngx_http_core_loc_conf_t *clcf;
ngx_http_lua_main_conf_t *lmcf;
@ -569,7 +591,18 @@ ngx_http_lua_content_by_lua(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
if (cmd->post == ngx_http_lua_content_handler_inline) {
chunkname = ngx_http_lua_gen_chunk_name(cf, "content_by_lua",
sizeof("content_by_lua") - 1);
if (chunkname == NULL) {
return NGX_CONF_ERROR;
}
llcf->content_chunkname = chunkname;
dd("chunkname: %s", chunkname);
/* Don't eval nginx variables for inline lua code */
llcf->content_src.value = value[1];
p = ngx_palloc(cf->pool, NGX_HTTP_LUA_INLINE_KEY_LEN + 1);
@ -629,7 +662,7 @@ ngx_http_lua_content_by_lua(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
char *
ngx_http_lua_log_by_lua(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
u_char *p;
u_char *p, *chunkname;
ngx_str_t *value;
ngx_http_lua_main_conf_t *lmcf;
ngx_http_lua_loc_conf_t *llcf = conf;
@ -658,7 +691,16 @@ ngx_http_lua_log_by_lua(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
if (cmd->post == ngx_http_lua_log_handler_inline) {
chunkname = ngx_http_lua_gen_chunk_name(cf, "log_by_lua",
sizeof("log_by_lua") - 1);
if (chunkname == NULL) {
return NGX_CONF_ERROR;
}
llcf->log_chunkname = chunkname;
/* Don't eval nginx variables for inline lua code */
llcf->log_src.value = value[1];
p = ngx_palloc(cf->pool, NGX_HTTP_LUA_INLINE_KEY_LEN + 1);
@ -995,4 +1037,45 @@ ngx_http_lua_set_by_lua_init(ngx_http_request_t *r)
}
#endif
static u_char *
ngx_http_lua_gen_chunk_name(ngx_conf_t *cf, const char *tag, size_t tag_len)
{
u_char *p, *out;
size_t len;
len = sizeof("=(:)") - 1 + tag_len + cf->conf_file->file.name.len
+ NGX_INT64_LEN + 1;
out = ngx_palloc(cf->pool, len);
if (out == NULL) {
return NULL;
}
if (cf->conf_file->file.name.len) {
p = cf->conf_file->file.name.data + cf->conf_file->file.name.len;
while (--p >= cf->conf_file->file.name.data) {
if (*p == '/' || *p == '\\') {
p++;
goto found;
}
}
p++;
} else {
p = cf->conf_file->file.name.data;
}
found:
ngx_snprintf(out, len, "=%*s(%*s:%d)%Z",
tag_len, tag, cf->conf_file->file.name.data
+ cf->conf_file->file.name.len - p,
p, cf->conf_file->line);
return out;
}
/* vi:set ft=c ts=4 sw=4 et fdm=marker: */

Просмотреть файл

@ -115,7 +115,8 @@ ngx_http_lua_log_handler_inline(ngx_http_request_t *r)
/* load Lua inline script (w/ cache) sp = 1 */
rc = ngx_http_lua_cache_loadbuffer(r, L, llcf->log_src.value.data,
llcf->log_src.value.len,
llcf->log_src_key, "=log_by_lua");
llcf->log_src_key,
(const char *) llcf->log_chunkname);
if (rc != NGX_OK) {
return NGX_ERROR;
}

Просмотреть файл

@ -754,24 +754,28 @@ ngx_http_lua_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
conf->rewrite_src = prev->rewrite_src;
conf->rewrite_handler = prev->rewrite_handler;
conf->rewrite_src_key = prev->rewrite_src_key;
conf->rewrite_chunkname = prev->rewrite_chunkname;
}
if (conf->access_src.value.len == 0) {
conf->access_src = prev->access_src;
conf->access_handler = prev->access_handler;
conf->access_src_key = prev->access_src_key;
conf->access_chunkname = prev->access_chunkname;
}
if (conf->content_src.value.len == 0) {
conf->content_src = prev->content_src;
conf->content_handler = prev->content_handler;
conf->content_src_key = prev->content_src_key;
conf->content_chunkname = prev->content_chunkname;
}
if (conf->log_src.value.len == 0) {
conf->log_src = prev->log_src;
conf->log_handler = prev->log_handler;
conf->log_src_key = prev->log_src_key;
conf->log_chunkname = prev->log_chunkname;
}
if (conf->header_filter_src.value.len == 0) {

Просмотреть файл

@ -179,7 +179,8 @@ ngx_http_lua_rewrite_handler_inline(ngx_http_request_t *r)
rc = ngx_http_lua_cache_loadbuffer(r, L, llcf->rewrite_src.value.data,
llcf->rewrite_src.value.len,
llcf->rewrite_src_key,
"=rewrite_by_lua");
(const char *)
llcf->rewrite_chunkname);
if (rc != NGX_OK) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}

Просмотреть файл

@ -10,7 +10,7 @@ use Test::Nginx::Socket::Lua;
repeat_each(2);
#repeat_each(1);
plan tests => repeat_each() * (blocks() * 2 + 18);
plan tests => repeat_each() * (blocks() * 2 + 19);
#no_diff();
#no_long_string();
@ -76,6 +76,8 @@ Yay! 123
GET /lua
--- response_body_like: 500 Internal Server Error
--- error_code: 500
--- error_log
content_by_lua(nginx.conf:39):1: attempt to call field 'echo' (a nil value)

Просмотреть файл

@ -31,7 +31,7 @@ GET /log
before log
after log
--- error_log eval
qr/\[\] \S+: \S+ \[lua\] content_by_lua:3: hello, log12343.14159/
qr/\[\] \S+: \S+ \[lua\] content_by_lua\(nginx\.conf:\d+\):3: hello, log12343.14159/
@ -50,7 +50,7 @@ GET /log
before log
after log
--- error_log eval
qr/\[emerg\] \S+: \S+ \[lua\] content_by_lua:3: hello, log12343.14159/
qr/\[emerg\] \S+: \S+ \[lua\] content_by_lua\(nginx\.conf:\d+\):3: hello, log12343.14159/
@ -69,7 +69,7 @@ GET /log
before log
after log
--- error_log eval
qr/\[alert\] \S+: \S+ \[lua\] content_by_lua:3: hello, log12343.14159/
qr/\[alert\] \S+: \S+ \[lua\] content_by_lua\(nginx\.conf:\d+\):3: hello, log12343.14159/
@ -88,7 +88,7 @@ GET /log
before log
after log
--- error_log eval
qr/\[crit\] \S+: \S+ \[lua\] content_by_lua:3: hello, log12343.14159/
qr/\[crit\] \S+: \S+ \[lua\] content_by_lua\(nginx\.conf:\d+\):3: hello, log12343.14159/
@ -107,7 +107,7 @@ GET /log
before log
after log
--- error_log eval
qr/\[error\] \S+: \S+ \[lua\] content_by_lua:3: hello, log12343.14159/
qr/\[error\] \S+: \S+ \[lua\] content_by_lua\(nginx\.conf:\d+\):3: hello, log12343.14159/
@ -126,7 +126,7 @@ GET /log
before log
after log
--- error_log eval
qr/\[warn\] \S+: \S+ \[lua\] content_by_lua:3: hello, log12343.14159/
qr/\[warn\] \S+: \S+ \[lua\] content_by_lua\(nginx\.conf:\d+\):3: hello, log12343.14159/
@ -145,7 +145,7 @@ GET /log
before log
after log
--- error_log eval
qr/\[notice\] \S+: \S+ \[lua\] content_by_lua:3: hello, log12343.14159/
qr/\[notice\] \S+: \S+ \[lua\] content_by_lua\(nginx\.conf:\d+\):3: hello, log12343.14159/
@ -164,7 +164,7 @@ GET /log
before log
after log
--- error_log eval
qr/\[info\] \S+: \S+ \[lua\] content_by_lua:3: hello, log12343.14159/
qr/\[info\] \S+: \S+ \[lua\] content_by_lua\(nginx\.conf:\d+\):3: hello, log12343.14159/
@ -183,7 +183,7 @@ GET /log
before log
after log
--- error_log eval
qr/\[debug\] \S+: \S+ \[lua\] content_by_lua:3: hello, log12343.14159/
qr/\[debug\] \S+: \S+ \[lua\] content_by_lua\(nginx\.conf:\d+\):3: hello, log12343.14159/
@ -202,7 +202,7 @@ GET /log
before log
after log
--- error_log eval
qr/\[notice\] \S+: \S+ \[lua\] content_by_lua:3: hello, log12343.14159/
qr/\[notice\] \S+: \S+ \[lua\] content_by_lua\(nginx\.conf:\d+\):3: hello, log12343.14159/
@ -222,9 +222,9 @@ GET /log
hi
--- error_log eval
[
'[lua] content_by_lua:2: ,',
'[lua] content_by_lua:3: nil,',
'[lua] content_by_lua:4: nil: nil,',
qr/\[lua\] content_by_lua\(nginx\.conf:\d+\):2: ,/,
qr/\[lua\] content_by_lua\(nginx\.conf:\d+\):3: nil,/,
qr/\[lua\] content_by_lua\(nginx\.conf:\d+\):4: nil: nil,/,
]
@ -342,7 +342,7 @@ GET /log
--- response_body
done
--- error_log eval
qr/\[error\] \S+: \S+ \[lua\] content_by_lua:7: bar\(\): hello, log12343.14159/
qr/\[error\] \S+: \S+ \[lua\] content_by_lua\(nginx\.conf:\d+\):7: bar\(\): hello, log12343.14159/
@ -372,7 +372,7 @@ GET /log
--- response_body
done
--- error_log eval
qr/\[error\] \S+: \S+ \[lua\] content_by_lua:8:(?: foo\(\):)? hello, log12343.14159/
qr/\[error\] \S+: \S+ \[lua\] content_by_lua\(nginx\.conf:\d+\):8:(?: foo\(\):)? hello, log12343.14159/

Просмотреть файл

@ -307,11 +307,13 @@ $/
--- abort
--- wait: 0.6
--- ignore_response
--- error_log
client prematurely closed connection
on abort called
lua user thread aborted: runtime error: rewrite_by_lua:4: attempt to abort with pending subrequests
main handler done
--- error_log eval
[
'client prematurely closed connection',
'on abort called',
qr/lua user thread aborted: runtime error: rewrite_by_lua\(nginx\.conf:\d+\):4: attempt to abort with pending subrequests/,
'main handler done',
]

Просмотреть файл

@ -2088,8 +2088,9 @@ GET /main
qr/^connected
<html.*?500 Internal Server Error/ms
--- error_log
runtime error: rewrite_by_lua:7: bad request
--- error_log eval
qr/runtime error: rewrite_by_lua\(nginx\.conf:\d+\):7: bad request/
--- no_error_log
[alert]
@ -2146,8 +2147,9 @@ GET /main
qr/^connected
<html.*?500 Internal Server Error/ms
--- error_log
runtime error: rewrite_by_lua:14: bad request
--- error_log eval
qr/runtime error: rewrite_by_lua\(nginx\.conf:\d+\):14: bad request/
--- no_error_log
[alert]
@ -2204,8 +2206,9 @@ GET /main
qr/^connected
<html.*?500 Internal Server Error/ms
--- error_log
runtime error: rewrite_by_lua:14: bad request
--- error_log eval
qr/runtime error: rewrite_by_lua\(nginx\.conf:\d+\):14: bad request/
--- no_error_log
[alert]
@ -2262,8 +2265,9 @@ GET /main
qr/^connected
<html.*?500 Internal Server Error/ms
--- error_log
runtime error: rewrite_by_lua:14: bad request
--- error_log eval
qr/runtime error: rewrite_by_lua\(nginx\.conf:\d+\):14: bad request/
--- no_error_log
[alert]
@ -2320,8 +2324,9 @@ GET /main
qr/^connected
<html.*?500 Internal Server Error/ms
--- error_log
runtime error: rewrite_by_lua:14: bad request
--- error_log eval
qr/runtime error: rewrite_by_lua\(nginx\.conf:\d+\):14: bad request/
--- no_error_log
[alert]
@ -2381,8 +2386,9 @@ GET /main
qr/^connected
<html.*?500 Internal Server Error/ms
--- error_log
runtime error: rewrite_by_lua:16: bad request
--- error_log eval
qr/runtime error: rewrite_by_lua\(nginx\.conf:\d+\):16: bad request/
--- no_error_log
[alert]

Просмотреть файл

@ -233,8 +233,8 @@ delete thread 1
--- response_body
after
--- error_log
lua user thread aborted: runtime error: rewrite_by_lua:3: attempt to call field 'blah' (a nil value)
--- error_log eval
qr/lua user thread aborted: runtime error: rewrite_by_lua\(nginx\.conf:\d+\):3: attempt to call field 'blah' \(a nil value\)/

Просмотреть файл

@ -304,11 +304,13 @@ lua req cleanup
--- abort
--- wait: 0.6
--- ignore_response
--- error_log
client prematurely closed connection
on abort called
lua user thread aborted: runtime error: access_by_lua:4: attempt to abort with pending subrequests
main handler done
--- error_log eval
[
'client prematurely closed connection',
'on abort called',
qr/lua user thread aborted: runtime error: access_by_lua\(nginx\.conf:\d+\):4: attempt to abort with pending subrequests/,
'main handler done',
]

Просмотреть файл

@ -233,8 +233,8 @@ delete thread 1
--- response_body
after
--- error_log
lua user thread aborted: runtime error: access_by_lua:3: attempt to call field 'blah' (a nil value)
--- error_log eval
qr/lua user thread aborted: runtime error: access_by_lua\(nginx\.conf:\d+\):3: attempt to call field 'blah' \(a nil value\)/

Просмотреть файл

@ -315,8 +315,8 @@ POST /test
yeah
--- response_body_like: 500 Internal Server Error
--- error_code: 500
--- error_log
lua entry thread aborted: runtime error: content_by_lua:2: request body not read yet
--- error_log eval
qr/lua entry thread aborted: runtime error: content_by_lua\(nginx\.conf:\d+\):2: request body not read yet/
--- no_error_log
[alert]
@ -573,8 +573,9 @@ hello, world
Will you change this world?
--- response_body_like: 500 Internal Server Error
--- error_code: 500
--- error_log
lua entry thread aborted: runtime error: rewrite_by_lua:3: request body not read yet
--- error_log eval
qr/lua entry thread aborted: runtime error: rewrite_by_lua\(nginx\.conf:\d+\):3: request body not read yet/
--- no_error_log
[alert]
@ -976,8 +977,9 @@ a client request body is buffered to a temporary file
GET /t
--- response_body_like: 500 Internal Server Error
--- error_code: 500
--- error_log
lua entry thread aborted: runtime error: content_by_lua:2: request body not read yet
--- error_log eval
qr/lua entry thread aborted: runtime error: content_by_lua\(nginx\.conf:\d+\):2: request body not read yet/
--- no_error_log
[alert]

Просмотреть файл

@ -2716,8 +2716,9 @@ GET /main
qr/^connected
<html.*?500 Internal Server Error/ms
--- error_log
runtime error: content_by_lua:7: bad request
--- error_log eval
qr/runtime error: content_by_lua\(nginx\.conf:\d+\):7: bad request/
--- no_error_log
[alert]
@ -2772,8 +2773,9 @@ GET /main
qr/^connected
<html.*?500 Internal Server Error/ms
--- error_log
runtime error: content_by_lua:14: bad request
--- error_log eval
qr/runtime error: content_by_lua\(nginx\.conf:\d+\):14: bad request/
--- no_error_log
[alert]
@ -2828,8 +2830,9 @@ GET /main
qr/^connected
<html.*?500 Internal Server Error/ms
--- error_log
runtime error: content_by_lua:14: bad request
--- error_log eval
qr/runtime error: content_by_lua\(nginx\.conf:\d+\):14: bad request/
--- no_error_log
[alert]
@ -2884,8 +2887,9 @@ GET /main
qr/^connected
<html.*?500 Internal Server Error/ms
--- error_log
runtime error: content_by_lua:14: bad request
--- error_log eval
qr/runtime error: content_by_lua\(nginx\.conf:\d+\):14: bad request/
--- no_error_log
[alert]
@ -2940,8 +2944,9 @@ GET /main
qr/^connected
<html.*?500 Internal Server Error/ms
--- error_log
runtime error: content_by_lua:14: bad request
--- error_log eval
qr/runtime error: content_by_lua\(nginx\.conf:\d+\):14: bad request/
--- no_error_log
[alert]
@ -2999,8 +3004,9 @@ GET /main
qr/^connected
<html.*?500 Internal Server Error/ms
--- error_log
runtime error: content_by_lua:16: bad request
--- error_log eval
qr/runtime error: content_by_lua\(nginx\.conf:\d+\):16: bad request/
--- no_error_log
[alert]

Просмотреть файл

@ -46,11 +46,12 @@ __DATA__
}
--- request
GET /test
--- response_body
res len: 2
res: falsecontent_by_lua:4: zero error
--- response_body eval
qr/^res len: 2
res: falsecontent_by_lua\(nginx\.conf:\d+\):4: zero error
res len: 4
res: true23hellotrue
$/s
--- no_error_log
[error]
@ -94,12 +95,14 @@ res: true23hellotrue
}
--- request
GET /test
--- response_body
error handler called: content_by_lua:4: zero error
--- response_body eval
qr/^error handler called: content_by_lua\(nginx\.conf:\d+\):4: zero error
res len: 2
res: falsethis is the new err
res len: 4
res: true23hellotrue
$/
--- no_error_log
[error]

Просмотреть файл

@ -58,13 +58,15 @@ attempt to call global 'lua_concat'
--- request
GET /lua
--- ignore_response
--- error_log
lua entry thread aborted: runtime error: unknown reason
stack traceback:
in function 'error'
: in function 'bar'
:5: in function 'foo'
:7: in function <content_by_lua:1>
--- error_log eval
[
'lua entry thread aborted: runtime error: unknown reason',
'stack traceback:',
" in function 'error'",
": in function 'bar'",
":5: in function 'foo'",
qr/:7: in function <content_by_lua\(nginx\.conf:\d+\):1>/,
]

Просмотреть файл

@ -201,8 +201,8 @@ lua release ngx.ctx
GET /lua
--- response_body
ok
--- error_log
failed to run log_by_lua*: log_by_lua:1: Bad
--- error_log eval
qr/failed to run log_by_lua\*: log_by_lua\(nginx\.conf:\d+\):1: Bad/
@ -577,8 +577,9 @@ GET /lua
--- response_body
ok
--- error_log
log_by_lua:1: content-type: text/plain
--- error_log eval
qr{log_by_lua\(nginx\.conf:\d+\):1: content-type: text/plain}
--- no_error_log
[error]

Просмотреть файл

@ -262,8 +262,8 @@ M(http-lua-info) {
--- request
GET /main
--- response_body_like: \b500\b
--- error_log
content_by_lua:8: bad request
--- error_log eval
qr/content_by_lua\(nginx\.conf:\d+\):8: bad request/
@ -327,8 +327,8 @@ end
--- request
GET /main
--- response_body_like: \b500\b
--- error_log
content_by_lua:6: bad request
--- error_log eval
qr/content_by_lua\(nginx\.conf:\d+\):6: bad request/
@ -868,8 +868,9 @@ GET /main
qr/^peer set
<html.*?500 Internal Server Error/ms
--- error_log
runtime error: content_by_lua:14: bad request
--- error_log eval
qr/runtime error: content_by_lua\(nginx\.conf:\d+\):14: bad request/
--- no_error_log
[alert]
@ -924,8 +925,9 @@ GET /main
qr/^peer set
<html.*?500 Internal Server Error/ms
--- error_log
runtime error: content_by_lua:14: bad request
--- error_log eval
qr/runtime error: content_by_lua\(nginx\.conf:\d+\):14: bad request/
--- no_error_log
[alert]
@ -980,8 +982,9 @@ GET /main
qr/^peer set
<html.*?500 Internal Server Error/ms
--- error_log
runtime error: content_by_lua:14: bad request
--- error_log eval
qr/runtime error: content_by_lua\(nginx\.conf:\d+\):14: bad request/
--- no_error_log
[alert]
@ -1036,8 +1039,9 @@ GET /main
qr/^peer set
<html.*?500 Internal Server Error/ms
--- error_log
runtime error: content_by_lua:14: bad request
--- error_log eval
qr/runtime error: content_by_lua\(nginx\.conf:\d+\):14: bad request/
--- no_error_log
[alert]
@ -1092,8 +1096,9 @@ GET /main
qr/^peer set
<html.*?500 Internal Server Error/ms
--- error_log
runtime error: content_by_lua:14: bad request
--- error_log eval
qr/runtime error: content_by_lua\(nginx\.conf:\d+\):14: bad request/
--- no_error_log
[alert]

Просмотреть файл

@ -897,12 +897,13 @@ chunk: true
}
--- request
GET /t
--- response_body
child: resume: falsecontent_by_lua:4: bad
--- response_body eval
qr/^child: resume: falsecontent_by_lua\(nginx\.conf:\d+\):4: bad
child: status: dead
parent: status: running
--- error_log
lua coroutine: runtime error: content_by_lua:4: bad
$/s
--- error_log eval
qr/lua coroutine: runtime error: content_by_lua\(nginx\.conf:\d+\):4: bad/

Просмотреть файл

@ -223,8 +223,8 @@ delete thread 1
--- response_body
after
--- error_log
lua user thread aborted: runtime error: content_by_lua:3: attempt to call field 'blah' (a nil value)
--- error_log eval
qr/lua user thread aborted: runtime error: content_by_lua\(nginx\.conf:\d+\):3: attempt to call field 'blah' \(a nil value\)/

Просмотреть файл

@ -419,8 +419,8 @@ delete thread 1
hello in thread
thread created: zombie
failed to wait thread: bad bad!
--- error_log
lua user thread aborted: runtime error: content_by_lua:4: bad bad!
--- error_log eval
qr/lua user thread aborted: runtime error: content_by_lua\(nginx\.conf:\d+\):4: bad bad!/
@ -469,8 +469,8 @@ delete thread 1
thread created: running
hello in thread
failed to wait thread: bad bad!
--- error_log
lua user thread aborted: runtime error: content_by_lua:5: bad bad!
--- error_log eval
qr/lua user thread aborted: runtime error: content_by_lua\(nginx\.conf:\d+\):5: bad bad!/
@ -885,8 +885,8 @@ failed to wait thread: f done
f status: dead
g status: zombie
--- error_log
lua user thread aborted: runtime error: content_by_lua:7: f done
--- error_log eval
qr/lua user thread aborted: runtime error: content_by_lua\(nginx\.conf:\d+\):7: f done/
@ -961,8 +961,8 @@ f status: dead
g status: running
g: hello
--- error_log
lua user thread aborted: runtime error: content_by_lua:8: f done
--- error_log eval
qr/lua user thread aborted: runtime error: content_by_lua\(nginx\.conf:\d+\):8: f done/
@ -1184,8 +1184,8 @@ delete thread 1
--- response_body_like: 500 Internal Server Error
--- error_code: 500
--- error_log
lua entry thread aborted: runtime error: content_by_lua:11: attempt to wait on a coroutine that is not a user thread
--- error_log eval
qr/lua entry thread aborted: runtime error: content_by_lua\(nginx\.conf:\d+\):11: attempt to wait on a coroutine that is not a user thread/
@ -1220,8 +1220,8 @@ delete thread 2
--- response_body
ok
--- error_log
lua user thread aborted: runtime error: content_by_lua:5: f done
--- error_log eval
qr/lua user thread aborted: runtime error: content_by_lua\(nginx\.conf:\d+\):5: f done/

Просмотреть файл

@ -296,11 +296,13 @@ lua req cleanup
--- abort
--- wait: 0.7
--- ignore_response
--- error_log
client prematurely closed connection
on abort called
lua user thread aborted: runtime error: content_by_lua:4: attempt to abort with pending subrequests
main handler done
--- error_log eval
[
'client prematurely closed connection',
'on abort called',
qr/lua user thread aborted: runtime error: content_by_lua\(nginx\.conf:\d+\):4: attempt to abort with pending subrequests/,
'main handler done',
]

Просмотреть файл

@ -69,7 +69,7 @@ timer prematurely expired: true
--- error_log eval
[
qr/\[lua\] content_by_lua:\d+: elapsed: 0\.0(?:4[4-9]|5[0-6])\d*, context: ngx\.timer/,
qr/\[lua\] content_by_lua\(nginx\.conf:\d+\):\d+: elapsed: 0\.0(?:4[4-9]|5[0-6])\d*, context: ngx\.timer/,
"lua ngx.timer expired",
"http lua close fake http connection",
"timer prematurely expired: false",
@ -115,7 +115,7 @@ foo = nil
--- error_log eval
[
qr/\[lua\] content_by_lua:\d+: elapsed: 0\.0(?:4[4-9]|5[0-6])/,
qr/\[lua\] content_by_lua\(nginx\.conf:\d+\):\d+: elapsed: 0\.0(?:4[4-9]|5[0-6])/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -161,7 +161,7 @@ foo = 3
--- error_log eval
[
qr/\[lua\] content_by_lua:\d+: elapsed: 0\.0(?:4[4-9]|5[0-6])/,
qr/\[lua\] content_by_lua\(nginx\.conf:\d+\):\d+: elapsed: 0\.0(?:4[4-9]|5[0-6])/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -209,7 +209,7 @@ registered timer
--- error_log eval
[
qr/\[lua\] .*? my lua timer handler/,
qr/\[lua\] content_by_lua:\d+: elapsed: 0\.0(?:6[4-9]|7[0-6])/,
qr/\[lua\] content_by_lua\(nginx\.conf:\d+\):\d+: elapsed: 0\.0(?:6[4-9]|7[0-6])/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -455,7 +455,7 @@ registered timer
--- error_log eval
[
qr/\[lua\] content_by_lua:\d+: elapsed: 0(?:[^.]|\.00)/,
qr/\[lua\] content_by_lua\(nginx\.conf:\d+\):\d+: elapsed: 0(?:[^.]|\.00)/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -588,7 +588,7 @@ hello world
[
"registered timer",
qr/\[lua\] .*? my lua timer handler/,
qr/\[lua\] log_by_lua:\d+: elapsed: 0\.0(?:6[4-9]|7[0-6])/,
qr/\[lua\] log_by_lua\(nginx\.conf:\d+\):\d+: elapsed: 0\.0(?:6[4-9]|7[0-6])/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -2114,7 +2114,7 @@ timer prematurely expired: true
--- error_log eval
[
qr/\[lua\] content_by_lua:\d+: elapsed: 0\.0(?:4[4-9]|5[0-6])\d*, context: ngx\.timer/,
qr/\[lua\] content_by_lua\(nginx\.conf:\d+\):\d+: elapsed: 0\.0(?:4[4-9]|5[0-6])\d*, context: ngx\.timer/,
"lua ngx.timer expired",
"http lua close fake http connection",
"timer prematurely expired: false",
@ -2157,7 +2157,7 @@ timer prematurely expired: true
--- error_log eval
[
qr/\[lua\] content_by_lua:\d+: elapsed: .*?, context: ngx\.timer/,
qr/\[lua\] content_by_lua\(nginx\.conf:\d+\):\d+: elapsed: .*?, context: ngx\.timer/,
"lua ngx.timer expired",
"http lua close fake http connection",
"timer prematurely expired: false",

Просмотреть файл

@ -49,7 +49,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the current context/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the current context/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -88,7 +88,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the current context/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the current context/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -127,7 +127,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the current context/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the current context/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -166,7 +166,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the current context/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the current context/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -205,7 +205,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the current context/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the current context/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -244,7 +244,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the current context/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the current context/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -283,7 +283,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the current context/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the current context/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -322,7 +322,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the current context/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the current context/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -361,7 +361,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the current context/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the current context/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -400,7 +400,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the context of ngx\.timer/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the context of ngx\.timer/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -439,7 +439,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the context of ngx\.timer/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the context of ngx\.timer/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -478,7 +478,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the context of ngx\.timer/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the context of ngx\.timer/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -517,7 +517,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the context of ngx\.timer/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the context of ngx\.timer/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -556,7 +556,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the context of ngx\.timer/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the context of ngx\.timer/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -595,7 +595,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the context of ngx\.timer/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the context of ngx\.timer/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -634,7 +634,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the current context/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the current context/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -673,7 +673,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the context of ngx\.timer/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the context of ngx\.timer/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -712,7 +712,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the current context/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the current context/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -751,7 +751,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the current context/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the current context/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -790,7 +790,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the current context/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the current context/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -829,7 +829,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the context of ngx\.timer/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the context of ngx\.timer/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -868,7 +868,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the context of ngx\.timer/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the context of ngx\.timer/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -907,7 +907,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the context of ngx\.timer/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the context of ngx\.timer/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -946,7 +946,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the current context/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the current context/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -985,7 +985,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the current context/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the current context/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -1024,7 +1024,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the current context/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the current context/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -1063,7 +1063,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the current context/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the current context/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -1102,7 +1102,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the current context/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the current context/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -1141,7 +1141,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the current context/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the current context/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -1180,7 +1180,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the current context/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the current context/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -1219,7 +1219,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the current context/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the current context/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -1258,7 +1258,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the current context/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the current context/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -1297,7 +1297,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the current context/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the current context/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -1336,7 +1336,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the current context/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the current context/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -1375,7 +1375,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the context of ngx\.timer/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the context of ngx\.timer/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -1417,7 +1417,7 @@ registered timer
--- error_log eval
[
qr/\[error\] .*? runtime error: content_by_lua:3: API disabled in the context of ngx\.timer/,
qr/\[error\] .*? runtime error: content_by_lua\(nginx\.conf:\d+\):3: API disabled in the context of ngx\.timer/,
"lua ngx.timer expired",
"http lua close fake http connection"
]

Просмотреть файл

@ -68,7 +68,7 @@ registered timer
--- error_log eval
[
qr/\[lua\] content_by_lua:\d+: elapsed: 0\.0(?:4[4-9]|5[0-6])/,
qr/\[lua\] content_by_lua\(nginx\.conf:\d+\):\d+: elapsed: 0\.0(?:4[4-9]|5[0-6])/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -117,7 +117,7 @@ registered timer
--- error_log eval
[
qr/\[lua\] .*? my lua timer handler/,
qr/\[lua\] content_by_lua:\d+: elapsed: 0\.0(?:6[4-9]|7[0-6])/,
qr/\[lua\] content_by_lua\(nginx\.conf:\d+\):\d+: elapsed: 0\.0(?:6[4-9]|7[0-6])/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -365,7 +365,7 @@ registered timer
--- error_log eval
[
qr/\[lua\] content_by_lua:\d+: elapsed: 0(?:[^.]|\.00)/,
qr/\[lua\] content_by_lua\(nginx\.conf:\d+\):\d+: elapsed: 0(?:[^.]|\.00)/,
"lua ngx.timer expired",
"http lua close fake http connection"
]
@ -500,7 +500,7 @@ hello world
[
"registered timer",
qr/\[lua\] .*? my lua timer handler/,
qr/\[lua\] log_by_lua:\d+: elapsed: 0\.0(?:6[4-9]|7[0-6])/,
qr/\[lua\] log_by_lua\(nginx\.conf:\d+\):\d+: elapsed: 0\.0(?:6[4-9]|7[0-6])/,
"lua ngx.timer expired",
"http lua close fake http connection"
]