Skip to content

Commit cdcbef3

Browse files
committed
Merge branch 'master' into cosocket
2 parents ef311cd + 87ebe18 commit cdcbef3

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/ngx_http_lua_exception.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ jmp_buf ngx_http_lua_exception;
2222
int
2323
ngx_http_lua_atpanic(lua_State *L)
2424
{
25-
const char *s;
25+
u_char *s;
26+
size_t len = 0;
2627
ngx_http_request_t *r;
2728

2829
lua_getglobal(L, GLOBALS_SYMBOL_REQUEST);
@@ -31,9 +32,9 @@ ngx_http_lua_atpanic(lua_State *L)
3132

3233
/* log Lua VM crashing reason to error log */
3334
if (r && r->connection && r->connection->log) {
34-
s = luaL_checkstring(L, 1);
35+
s = (u_char *) lua_tolstring(L, 1, &len);
3536
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
36-
"(lua-atpanic) Lua VM crashed, reason: %s", s);
37+
"(lua-atpanic) Lua VM crashed, reason: %*s", len, s);
3738

3839
} else {
3940
dd("(lua-atpanic) can't output Lua VM crashing reason to error log"

src/ngx_http_lua_util.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,13 @@ ngx_http_lua_new_thread(ngx_http_request_t *r, lua_State *L, int *ref)
199199
*ref = luaL_ref(L, -2);
200200

201201
if (*ref == LUA_NOREF) {
202-
lua_settop(L, top); /* restore main trhead stack */
202+
lua_settop(L, top); /* restore main thread stack */
203203
return NULL;
204204
}
205205
}
206206

207-
/* pop coroutine refernece on main thread's stack after anchoring it
208-
* in registery */
207+
/* pop coroutine reference on main thread's stack after anchoring it
208+
* in registry */
209209
lua_pop(L, 1);
210210

211211
return cr;
@@ -488,21 +488,21 @@ init_ngx_lua_registry(ngx_conf_t *cf, lua_State *L)
488488
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, cf->log, 0,
489489
"lua initializing lua registry");
490490

491-
/* {{{ register table to anchor lua coroutines reliablly:
491+
/* {{{ register a table to anchor lua coroutines reliably:
492492
* {([int]ref) = [cort]} */
493493
lua_newtable(L);
494494
lua_setfield(L, LUA_REGISTRYINDEX, NGX_LUA_CORT_REF);
495495
/* }}} */
496496

497-
/* create registry entry for the Lua request ctx data table */
497+
/* create the registry entry for the Lua request ctx data table */
498498
lua_newtable(L);
499499
lua_setfield(L, LUA_REGISTRYINDEX, NGX_LUA_REQ_CTX_REF);
500500

501-
/* create registry entry for the Lua socket connection pool table */
501+
/* create the registry entry for the Lua socket connection pool table */
502502
lua_newtable(L);
503503
lua_setfield(L, LUA_REGISTRYINDEX, NGX_LUA_SOCKET_POOL);
504504

505-
/* create registry entry for the Lua request ctx data table */
505+
/* create the registry entry for the Lua precompiled regex object cache */
506506
lua_newtable(L);
507507
lua_setfield(L, LUA_REGISTRYINDEX, NGX_LUA_REGEX_CACHE);
508508

0 commit comments

Comments
 (0)