Skip to content

balancer_by_lua_file segmentation fault since commit 246ec8a #1572

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DejanPelzel opened this issue Aug 2, 2019 · 1 comment
Closed

balancer_by_lua_file segmentation fault since commit 246ec8a #1572

DejanPelzel opened this issue Aug 2, 2019 · 1 comment

Comments

@DejanPelzel
Copy link

DejanPelzel commented Aug 2, 2019

Hello,

We are using a long list of upstreams using balancer_by_lua_file. The total number is around 700. Since commit 246ec8a this is causing segmentation faults when starting nginx. Reducing the number of upstreams to 40 or less usually helps, but not always, it seems a random combination of the zone size and upstream count etc.

We tested this on nginx versions Nginx version 1.15.12 until 1.17.2 and the segmentation fault happens consistently. The content of balancer_by_lua_file does not affect the results and the file can be blank for easier troubleshooting.

An example list goes like this:

upstream dynamic_proxy_upstream1 {
	server 0.0.0.1;
	zone dynamic_upstream1 256k;
	balancer_by_lua_file /etc/nginx/balancer.lua;
	keepalive_timeout 120s;
	keepalive 100;
}

upstream dynamic_proxy_upstream2 {
	server 0.0.0.1;
	zone dynamic_upstream2 256k;
	balancer_by_lua_file /etc/nginx/balancer.lua;
	keepalive_timeout 120s;
	keepalive 100;
}

upstream dynamic_proxy_upstream3 {
	server 0.0.0.1;
	zone dynamic_upstream3 256k;
	balancer_by_lua_file /etc/nginx/balancer.lua;
	keepalive_timeout 120s;
	keepalive 100;
}

etc...

I've captured a coredump:

Thread 1: status = VgTs_Runnable (lwpid 9369)
==9369==    at 0x2BCDA2: ngx_http_lua_gen_file_cache_key_helper (ngx_http_lua_cache.c:383)
==9369==    by 0x2BCDA2: ngx_http_lua_gen_file_cache_key (ngx_http_lua_cache.c:400)
==9369==    by 0x2DC865: ngx_http_lua_balancer_by_lua (ngx_http_lua_balancer.c:158)
==9369==    by 0x1D3B43: ngx_conf_handler (ngx_conf_file.c:463)
==9369==    by 0x1D3B43: ngx_conf_parse (ngx_conf_file.c:319)
==9369==    by 0x214911: ngx_http_upstream (ngx_http_upstream.c:5795)
==9369==    by 0x1D3B43: ngx_conf_handler (ngx_conf_file.c:463)
==9369==    by 0x1D3B43: ngx_conf_parse (ngx_conf_file.c:319)
==9369==    by 0x1D3F15: ngx_conf_include (ngx_conf_file.c:841)
==9369==    by 0x1D3B43: ngx_conf_handler (ngx_conf_file.c:463)
==9369==    by 0x1D3B43: ngx_conf_parse (ngx_conf_file.c:319)
==9369==    by 0x1F3A45: ngx_http_block (ngx_http.c:237)
==9369==    by 0x1D3B43: ngx_conf_handler (ngx_conf_file.c:463)
==9369==    by 0x1D3B43: ngx_conf_parse (ngx_conf_file.c:319)
==9369==    by 0x1D0E59: ngx_init_cycle (ngx_cycle.c:275)
==9369==    by 0x1BF7BE: main (nginx.c:291)
@thibaultcha
Copy link
Member

Should be fixed in 2f27064, thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants