Hi Hyeonggeun,

I've currently queued your patch series and during testing I found
that this first patch introduces a regression with this config:

    global
        set-var-fmt proc.str "%[var(proc.str)] a string"

It segfaults during the parsing:

  Program terminated with signal SIGSEGV, Segmentation fault.
  #0  0x0000000000620809 in sample_convert (req_type=7, sample=0x7f6c59a30cf8) 
at include/haproxy/sample.h:75
  75              if (!sample_casts[sample->data.type][req_type])
  (gdb) bt
  #0  0x0000000000620809 in sample_convert (req_type=7, sample=0x7f6c59a30cf8) 
at include/haproxy/sample.h:75
  #1  sess_build_logline_orig (sess=sess@entry=0x309af70, s=s@entry=0x0, 
dst=dst@entry=0x309b060 "", 
      maxsize=<optimized out>, lf_expr=<optimized out>, log_orig=..., 
log_orig@entry=...) at src/log.c:4139
  #2  0x00000000007a3b82 in sess_build_logline (lf_expr=0x7fff8ae4e868, 
maxsize=<optimized out>, dst=0x309b060 "", 
      s=0x0, sess=0x309af70) at include/haproxy/log.h:94
  #3  action_store (rule=rule@entry=0x7fff8ae4e7d0, px=px@entry=0x7fff8ae4e900, 
sess=sess@entry=0x309af70, 
      s=s@entry=0x0, flags=flags@entry=0) at src/vars.c:858
  #4  0x00000000007a3e3c in vars_parse_global_set_var (args=0x7fff8ae4f940, 
section_type=<optimized out>, 
      curpx=<optimized out>, defpx=<optimized out>, file=<optimized out>, 
line=<optimized out>, err=0x7fff8ae4f5b8)
      at src/vars.c:1192
  #5  0x00000000007be8eb in cfg_parse_global (file=0x2a2a6d0 "crash-var.cfg", 
linenum=2, args=0x7fff8ae4f940, 
      kwm=<optimized out>) at src/cfgparse-global.c:863
  #6  0x00000000006be95f in parse_cfg (cfg=cfg@entry=0x2a2a6a0) at 
src/cfgparse.c:2754
  #7  0x00000000007384fa in read_cfg () at src/haproxy.c:1078

If I change either variable's name it's fine, so my guess is that we're
facing a subtlety related to the allocation or processing order of that
variable. At first glance I'd say that set-var() was parsed first and
the logformat expression was parsed second. I have not dug further for
now, but I wanted to let you know early in case it makes you think abou
something.

I've pushed the branch as "20260113-dump-vars-1" in case that helps.

Thanks,
Willy


Reply via email to