[syslog-ng] [Bug 128] New: template() broken in latest 3.3 git

bugzilla at bugzilla.balabit.com bugzilla at bugzilla.balabit.com
Sun Jul 3 22:31:40 CEST 2011


https://bugzilla.balabit.com/show_bug.cgi?id=128

           Summary: template() broken in latest 3.3 git
           Product: syslog-ng
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: unspecified
         Component: syslog-ng
        AssignedTo: bazsi at balabit.hu
        ReportedBy: algernon at balabit.hu
Type of the Report: ---
   Estimated Hours: 0.0


Hi!

While updating my 3.3 installation from an ancient version to latest git head, I noticed that template functions stopped working. If I have any kind of
template in the config, I get a segmentation fault:

,----
| Program received signal SIGSEGV, Segmentation fault.
| log_template_reset_compiled (self=0x0) at templates.c:661
| 661     while (self->compiled_template)
| (gdb) bt
| #0  log_template_reset_compiled (self=0x0) at templates.c:661
| #1  0x00007ffff7b9f302 in log_template_compile (self=0x0, template=0x63d7e0 "foo: bar", error=0x7fffffffb5d8) at templates.c:788
| #2  0x00007ffff5e96761 in affile_parse (lexer=<value optimized out>, instance=<value optimized out>, arg=<value optimized out>) at affile-grammar.y:592
| #3  0x00007ffff7b9bd72 in cfg_parser_parse (self=0x7ffff609ce30, cfg=<value optimized out>, yylloc=<value optimized out>, arg=<value optimized out>) at
cfg-parser.h:83
| #4  plugin_parse_config (self=0x7ffff609ce30, cfg=<value optimized out>, yylloc=<value optimized out>, arg=<value optimized out>) at plugin.c:124
| #5  0x00007ffff7ba89f7 in main_parse (lexer=<value optimized out>, dummy=<value optimized out>, arg=<value optimized out>) at cfg-grammar.y:592
| #6  0x00007ffff7b7ee93 in cfg_parser_parse (self=0x611720, lexer=0x6188a0, parser=0x7ffff7dd92a0, result=<value optimized out>, arg=<value optimized out>) at
cfg-parser.h:83
| #7  cfg_run_parser (self=0x611720, lexer=0x6188a0, parser=0x7ffff7dd92a0, result=<value optimized out>, arg=<value optimized out>) at cfg.c:370
| #8  0x00007ffff7b7efa6 in cfg_read_config (self=0x611720, fname=0x7ffff7bb7068 "/home/algernon/tmp/sng/install/3.3/etc/syslog-ng.conf", syntax_only=<value
optimized out>, preprocess_into=0x0) at cfg.c:392
| #9  0x00007ffff7b970c1 in main_loop_init () at mainloop.c:611
| #10 0x0000000000401865 in main (argc=1, argv=0x7fffffffdc78) at main.c:242
| (gdb) 
`----

The config that triggers this is as follows:

,----
| @version: 3.3
| @include "scl.conf"
| 
| source s_local { internal(); };
| destination d_local { file("/tmp/template-test" template("foo: bar")); };
| log { source(s_local); destination(d_local); };
`----

After bisecting the problem, I ended up with the following commit:

,----
| 2443b07b90c822414a628aae6a9ca513357b52fc is the first bad commit
| commit 2443b07b90c822414a628aae6a9ca513357b52fc
| Author: Balazs Scheidler <bazsi at balabit.hu>
| Date:   Sat Jun 11 14:09:01 2011 +0200
| 
|     template: make template compilation thread safe
|     
|     Instead of doing template compilation on-demand, require the application
|     code to do it explicitly, at initialization, in order to avoid having to
|     acquire a lock during runtime.
|     
|     This patch contains an incompatible API change, and requires updating
|     all call-sites.
|     
|     The change makes it also possible to change template string of a constructed
|     LogTemplate class multiple times with a call to log_template_compile().
|     
|     Signed-off-by: Balazs Scheidler <bazsi at balabit.hu>
| 
| :040000 040000 a40fc910d215dac2184aa02ae1498c6748e3e64a dea1d2a7fc02d1d0ec8e095f2f62499ce42b895a M    lib
| :040000 040000 1641cf3152897406874716d4f090b5cc795292ab f66d2e5c482c3ff91b9d4219812766d66067c7a1 M    modules
| :040000 040000 2c2a37fd3a4f9c5bddc81813605c20ece033ce2f dff570d331b8e7ada6c1202761066878b9bb3910 M    tests
`----

I'm not quite sure why this happens yet, I'll keep digging. I'll post a patch if and when I figure out what exactly broke. Meanwhile, this bug report will
serve as a reminder for me to keep looking.


-- 
Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.


More information about the syslog-ng mailing list