On Tue, Mar 24, 2020 at 05:41:48PM +0100, Olivier D wrote:
> Hello,
> 
> With latest haproxy 2.0, you can generate a simple segfault with only
> configuration test (haproxy -f test.cfg -c)
> 
> 
> Config content :
> ----------------------
> defaults
>     mode http
> 
> backend test
>   stick-table type ip size 10k expire 1h store http_req_rate(1h) peers
> mypeers
> 
> peers mypeers
>     peer toto 127.0.0.1:1024
> -------------------------
> Running :
> [WARNING] 083/173758 (2599) : Removing incomplete section 'peers mypeers'
> (no peer named 'myhostname.localhost').
> Segmentation fault
> 
> peers_register_table (peers=0xc8a110, table=table@entry=0xc8c6f0) at
> src/peers.c:3028
> (gdb) bt
> #0  peers_register_table (peers=0xc8a110, table=table@entry=0xc8c6f0) at
> src/peers.c:3028
> #1  0x0000000000522bec in stktable_init (t=0xc8c6f0) at
> src/stick_table.c:644
> #2  0x000000000050fa67 in check_config_validity () at src/cfgparse.c:4048
> #3  0x0000000000505311 in init (argc=<optimized out>, argc@entry=4,
> argv=<optimized out>, argv@entry=0x7fffffffe848) at src/haproxy.c:1760
> #4  0x000000000046475f in main (argc=4, argv=0x7fffffffe848) at
> src/haproxy.c:2727
>


> I know my peer entry is not correct (my hostname is not "toto") but we
> should not end with a segfault ^^
>

I agree. It looks like this is the consequence of the peer being free'd
if you don't reference the local peer in the section. It should still
start in your case by specifying -L toto on the command line.

I think the peer pointer is still referenced in the stick-table which
tries to use it during its initialization. So if we want to free the
peer we need to remove its reference too.

-- 
William Lallemand

Reply via email to