Skip to content

Commit d6c5280

Browse files
author
jiahao
committed
bugfix: append new parameters to ngx_http_lua_ffi_balancer_set_current_peer at function end.
Avoid inserting new parameters in the middle of the function to prevent core dumps when using old lua-resty-core with new lua-nginx-module. Example stack trace: ``` Message: Process 1414245 (nginx) of user 1000 dumped core. Stack trace of thread 1414245: #0 0x00007ff596938285 __strlen_avx2 (libc.so.6 + 0x162285) openresty#1 0x00007ff596f623d2 lj_cf_ffi_string (libluajit-5.1.so.2 + 0x523d2) openresty#2 0x00007ff596f1bb4b lj_BC_FUNCC (libluajit-5.1.so.2 + 0xbb4b) openresty#3 0x00007ff596f74223 lua_pcall (libluajit-5.1.so.2 + 0x64223) openresty#4 0x00000000005044b7 n/a (/home/jiahao/work/org/lua-resty-core/work/nginx/sbin/nginx + 0x1044b7) ```
1 parent 934fe7f commit d6c5280

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ngx_http_lua_balancer.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -860,8 +860,8 @@ ngx_http_lua_balancer_save_session(ngx_peer_connection_t *pc, void *data)
860860
int
861861
ngx_http_lua_ffi_balancer_set_current_peer(ngx_http_request_t *r,
862862
const u_char *addr, size_t addr_len, int port,
863-
const u_char *host, size_t host_len,
864-
char **err)
863+
char **err,
864+
const u_char *host, size_t host_len)
865865
{
866866
ngx_url_t url;
867867
ngx_http_lua_ctx_t *ctx;

0 commit comments

Comments
 (0)