Michael, thank you for the bug repport. I reproduce it. It is introduced with the support of the RFC5424 for the logs format sublitted by dragan.
Hi Dragan, after your patch about the RFC5424, the funcion __send_log() no longer support NULL for the "*p" param. Can you fix this ? It seems that the 'log_htp' and the 'log_htp_rfc5424' members of the "struct proxy" contains preformatted strings. There makeby the function "lf_host_tag_pid()". Maybe, we should build a defaults strings (one for each rfc) at the start of haproxy, and uses these default strings if the proxy "*p" is NULL in the function "__send_log()" ? Thierry On Tue, 29 Sep 2015 07:37:12 -0400 Michael Ezzell <mich...@ezzell.net> wrote: > Although I am seeing this in Lua, it does not appear (to me) to a the fault > in the Lua code... recent changes in __send_log() in log.c appear to assume > p is never null (there's a test for this condition earlier, then p is > referenced later), and that is not valid behavior in this case, because > there is no proxy associated: > > (gdb) run > Starting program: /home/ubuntu/haproxy-1.6-dev6/haproxy -f ./haproxy.cfg > > Program received signal SIGSEGV, Segmentation fault. > __send_log (p=p@entry=0x0, level=level@entry=1, message=<optimized out>, > size=10, > sd=sd@entry=0x711160 <default_rfc5424_sd_log_format> "- ", > sd_size=sd_size@entry=2) at src/log.c:1025 > 1025 if (unlikely(htp->len >= maxlen)) { > (gdb) print htp->len > Cannot access memory at address 0xda4 > (gdb) print htp > $1 = (struct chunk *) 0xd98 > (gdb) print &p->log_htp > $2 = (struct chunk *) 0xd98 > (gdb) print p > $3 = (struct proxy *) 0x0 > (gdb) > > This minimal test case can be replicated with the following two files: > > $ cat haproxy.cfg > > global > log 127.0.0.1 local0 > lua-load crash.lua > user haproxy > group nogroup > daemon > > defaults > log global > > $ cat crash.lua > > core.Alert("hello.lua");