Repository navigation
Conversation
There was an incompatible change in struct utmp and the test to validate if we are using the old or the new format has been removed in the past decade somehow. Signed-off-by: Balazs Scheidler <[email protected]>
An ancient version of the compat library was present (and now rediscovered) in utils.c, move it to its new home. The inet_aton() implementation is coming in a separate patch. Signed-off-by: Balazs Scheidler <[email protected]>
…ction() Instead of doing a lot of ifdef trickery in the queue() function, use separate static wrappers for that. Also adds a locking around the use of the inherently non-thread-safe utmp interface. Signed-off-by: Balazs Scheidler <[email protected]>
The Linux kernel used to have a bug that caused the afuser driver to block even if O_NONBLOCK is set in the open flags. It was fixed a long time ago, and alarm() is incompatible with multithreaded programs, thus get rid off the alarm() call to detect blocked ttys. Signed-off-by: Balazs Scheidler <[email protected]>
Signed-off-by: Viktor Juhasz <[email protected]> Signed-off-by: Balazs Scheidler <[email protected]>
In some cases CHECK_ERROR() macro is invoked without an error message, which simply means it should simply return the grammar without producing a verbose error message. This happens when a recursive grammar already produced a meaningful error message. Instead of overloading CHECK_ERROR() with a NULL errormsg in this case, introduce a separate macro. This also fixes a warning when compiling with clang. Signed-off-by: Balazs Scheidler <[email protected]>
…iple times The typedef was already in the header, so no need to define it in the implementation module too. This fixes a warning when compiling with clang. Signed-off-by: Balazs Scheidler <[email protected]>
fread/fwrite returns signed quantity and anything below 0 indicates a failure. This code errorenously used gsize instead of gssize causing the error handling never to be triggered. Fortunately this code is only being used to upgrade a persist-state file in the older format, and read() rarely if ever fails once the file could successfully be opened. Signed-off-by: Balazs Scheidler <[email protected]>
The code that formatted the per-facility/severity stats counters used the guint16 format specifier for an int. This patch also fixes caused a warning when compiling with clang. Signed-off-by: Balazs Scheidler <[email protected]>
…_method() This patch removes an extra set of parentheses as it was unneeded and clang gave us a warning about that. Signed-off-by: Balazs Scheidler <[email protected]>
Read returns signed values and the simplistic syslog-ng-ctl interface used an unsigned value for that, causing the error handling portion of the slng_read_response() routine never to trigger. This patch fixes that. Signed-off-by: Balazs Scheidler <[email protected]>
Instead of sharing a home with the main syslog-ng binary, use a separate, dedicated folder. Signed-off-by: Balazs Scheidler <[email protected]>
Signed-off-by: Gergely Nagy <[email protected]>
Since the default version was switched to 3.6 earlier, bump the @Version of the default config and the in the func-tests too. Signed-off-by: Gergely Nagy <[email protected]>
Signed-off-by: Balazs Scheidler <[email protected]>
In order to run the SQL func tests, install sqlite3 and libdbd-sqlite3 too. Signed-off-by: Gergely Nagy <[email protected]>
Rearrange the README a little bit, putting the source installation docs at the top, adding more links, and rewording a few things here and there. Signed-off-by: Gergely Nagy <[email protected]>
The problem is that escape related flags just simply overwrite default flags and overwritten by non-escape flags. This patch is do the following in order to avoid undesired owerwrites: If new flag is an escape flag (and does not contain any other flags), previously set flags, without escape flags, are appended to that new flag. If new flag does not contain escape flags, escape flags from previously set flags are appended to that new flag. Otherwise new flag is overwrite previously set flags. Please note, that this solution is not the best( adding a new escape-mode() argument would be better than this workaround ). Signed-off-by: Budai Laszlo <[email protected]>
When building test programs (anything in ${check_PROGRAMS}) add
-no-install to the list of LDFLAGS, so that libtool stops generating a
useless wrapper for them. This makes debugging the check programs
easier, and also avoids a lot of shell launching for no good reason.
Signed-off-by: Gergely Nagy <[email protected]>
When log_dest_driver_acquire_queue() fails to acquire the queue, destination driver should not be started. Signed-off-by: Budai Laszlo <[email protected]>
A lot of the code that was previously in afsql_dd_insert_db() have been extracted to smaller functions, and afsql_dd_insert_db() was rebuilt on top of these. At the same time, memory leaks were plugged, and in case of a transaction error, backlog rewinding has been fixed too, to not loose messages since the last BEGIN command. Signed-off-by: Juhasz Viktor <[email protected]> Signed-off-by: Laszlo Budai <[email protected]>
When log_dest_driver_acquire_queue() fails to acquire the queue, afsql_dd_init() should fail too. Signed-off-by: Juhasz Viktor <[email protected]> Signed-off-by: Budai Laszlo <[email protected]>
Sequence numbering was restarted upon reload before, but with this patch, the number gets stored in the persist config, and read back from there upon reload. Signed-off-by: Juhasz Viktor <[email protected]> Signed-off-by: Budai Laszlo <[email protected]>
The testcase explicitly stopped syslog-ng, but didn't validate its return code. Fix that. Signed-off-by: Balazs Scheidler <[email protected]>
This patch aborts the reload process if termination is requested. The solution was to extend the use of the "under_termination" variable, which is not really nice. The alternative, better approach would be to serialize intrusive requests (e.g. reload/terminate) with a queue or something. If that were the case, no explicit handling would be needed. Signed-off-by: Balazs Scheidler <[email protected]>
…module Some communication takes place between syslog-ng and systemd after the former has started. We indicate when initialization at startup finished and also some textual messages to indicate our state. Earlier it was right in the middle of the mainloop code, now factor it out to a separate module, perhaps this interface can be useful for other similar implementations. Signed-off-by: Balazs Scheidler <[email protected]>
Instead of invoking it in main_loop_init(). Signed-off-by: Balazs Scheidler <[email protected]>
bazsi
added a commit
that referenced
this pull request
Feb 21, 2016
syslog-ng was crashing in my development environment at startup if the systemd-journal() driver was used, in a backtrace like this: Program received signal SIGSEGV, Segmentation fault. g_module_symbol (module=0x6771b0, symbol_name=0x7ffff4942a65 "sd_journal_open", symbol=0x7ffff7f838f0 <sd_journal_open>) at /build/glib2.0-ajuDY6/glib2.0-2.46.1/./gmodule/gmodule.c:818 818 /build/glib2.0-ajuDY6/glib2.0-2.46.1/./gmodule/gmodule.c: No such file or directory. (gdb) bt #0 g_module_symbol (module=0x6771b0, symbol_name=0x7ffff4942a65 "sd_journal_open", symbol=0x7ffff7f838f0 <sd_journal_open>) at /build/glib2.0-ajuDY6/glib2.0-2.46.1/./gmodule/gmodule.c:818 #1 0x00007ffff493e6cd in load_journald_subsystem () at /home/bazsi/zwa/projects/syslog-ng-ose-3.6/source/syslog-ng/modules/systemd-journal/journald-subsystem.c:105 #2 0x00007ffff493cd0c in systemd_journal_module_init (cfg=0x63a2a0, args=0x0) at /home/bazsi/zwa/projects/syslog-ng-ose-3.6/source/syslog-ng/modules/systemd-journal/systemd-journal-plugin.c:44 #3 0x00007ffff7b4a9d3 in plugin_load_module (module_name=0x6572a0 "sdjournal", cfg=0x63a2a0, args=0x0) at /home/bazsi/zwa/projects/syslog-ng-ose-3.6/source/syslog-ng/lib/plugin.c:385 #4 0x00007ffff7b4a18c in plugin_find (cfg=0x63a2a0, plugin_type=3, plugin_name=0x675c80 "systemd-journal") at /home/bazsi/zwa/projects/syslog-ng-ose-3.6/source/syslog-ng/lib/plugin.c:155 #5 0x00007ffff7b5ee8e in main_parse (lexer=0x63f010, dummy=0x7fffffffd0c8, arg=0x0) at /home/bazsi/zwa/projects/syslog-ng-ose-3.6/source/syslog-ng/lib/cfg-grammar.y:580 #6 0x00007ffff7b2a7a5 in cfg_parser_parse (self=0x7ffff7dd4ee0 <main_parser>, lexer=0x63f010, instance=0x7fffffffd0c8, arg=0x0) at /home/bazsi/zwa/projects/syslog-ng-ose-3.6/source/syslog-ng/lib/cfg-parser.h:83 #7 0x00007ffff7b2b7f7 in cfg_run_parser (self=0x63a2a0, lexer=0x63f010, parser=0x7ffff7dd4ee0 <main_parser>, result=0x7fffffffd0c8, arg=0x0) at /home/bazsi/zwa/projects/syslog-ng-ose-3.6/source/syslog-ng/lib/cfg.c:430 #8 0x00007ffff7b2ba3a in cfg_read_config (self=0x63a2a0, fname=0x60e940 "etc/syslog-ng.conf", syntax_only=0, preprocess_into=0x0) at /home/bazsi/zwa/projects/syslog-ng-ose-3.6/source/syslog-ng/lib/cfg.c:502 #9 0x00007ffff7b45368 in main_loop_read_and_init_config () at /home/bazsi/zwa/projects/syslog-ng-ose-3.6/source/syslog-ng/lib/mainloop.c:447 #10 0x0000000000401b31 in main (argc=1, argv=0x7fffffffd238) at /home/bazsi/zwa/projects/syslog-ng-ose-3.6/source/syslog-ng/syslog-ng/main.c:261 My belief is that the root cause was that the global variables in journald-subsystem.c are named the same as the symbols in libsystemd.so, and both are symbols with global visibility. My theory was that due to the name clash, the actual pointer passed to g_module_symbol() was pointing to the actual code of the functions, instead of the pointer we wanted to store the values. I didn't completely confirm this theory, but adding "static" qualifiers to the variables resolved the issue for me. Honestly, I don't really like how journal-systemd.c is organized, but this was only a distraction for me and I was satisfied with resolving the problem for now. Signed-off-by: Balazs Scheidler <[email protected]>
Kokan
added a commit
to Kokan/syslog-ng
that referenced
this pull request
Oct 2, 2020
Every time a key created a counter names is allocated. But it is not
freed. The only time it is freed when a new stats-cluster is created
from it (first time looked up) and the counter_names owenership
transfared to the stats-cluster.
With this patch the allocation is delayed to the ownership change, thus
only allocated if there is still a pointer to the memory.
Reproduction:
1. syslog-ng configuration with at least one network source
2. start syslog-ng with a leak detector
(2.1 optional do restart (in order to have the exact leak as above))
3. stop syslog-ng
=================================================================
==2095056==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 8 byte(s) in 1 object(s) allocated from:
#0 0x55a4f86db781 in calloc (/tmp/install/sbin/syslog-ng+0xc5781)
#1 0x7f343f03a941 in g_malloc0 (/usr/lib/libglib-2.0.so.0+0x50941)
syslog-ng#2 0x7f343acb37c7 in _make_connection_conter_stats_queryable /home/user/src/syslog-ng/build/../modules/afsocket/afsocket-source.c:1007:9
syslog-ng#3 0x7f343acb30f3 in afsocket_sd_init_method /home/user/src/syslog-ng/build/../modules/afsocket/afsocket-source.c:1060:5
syslog-ng#4 0x7f343acbc358 in afinet_sd_init /home/user/src/syslog-ng/build/../modules/afsocket/afinet-source.c:103:8
syslog-ng#5 0x7f343f248e1a in log_pipe_init /home/user/src/syslog-ng/build/../lib/logpipe.h:301:23
syslog-ng#6 0x7f343f248c88 in cfg_tree_start /home/user/src/syslog-ng/build/../lib/cfg-tree.c:1419:12
syslog-ng#7 0x7f343f23af71 in cfg_init /home/user/src/syslog-ng/build/../lib/cfg.c:368:8
syslog-ng#8 0x7f343f270b3c in main_loop_reload_config_apply /home/user/src/syslog-ng/build/../lib/mainloop.c:276:41
syslog-ng#9 0x7f343f273162 in _consume_action /home/user/src/syslog-ng/build/../lib/mainloop-worker.c:240:3
syslog-ng#10 0x7f343f27321f in _invoke_sync_call_actions /home/user/src/syslog-ng/build/../lib/mainloop-worker.c:250:7
syslog-ng#11 0x7f343f2736ba in main_loop_worker_sync_call /home/user/src/syslog-ng/build/../lib/mainloop-worker.c:396:7
syslog-ng#12 0x7f343f2709d1 in main_loop_reload_config_commence /home/user/src/syslog-ng/build/../lib/mainloop.c:340:3
syslog-ng#13 0x7f343f275852 in control_connection_reload /home/user/src/syslog-ng/build/../lib/mainloop-control.c:167:3
syslog-ng#14 0x7f343f290c80 in control_connection_io_input /home/user/src/syslog-ng/build/../lib/control/control-server.c:378:3
syslog-ng#15 0x7f343efd4b2c (/usr/lib/libivykis.so.0+0x6b2c)
syslog-ng#16 0x7f343f239c50 in run_application_hook /home/user/src/syslog-ng/build/../lib/apphook.c:125:11
Direct leak of 8 byte(s) in 1 object(s) allocated from:
#0 0x55a4f86db781 in calloc (/tmp/install/sbin/syslog-ng+0xc5781)
#1 0x7f343f03a941 in g_malloc0 (/usr/lib/libglib-2.0.so.0+0x50941)
syslog-ng#2 0x7f343acb3e27 in _stop_connection_counter_stats_queryable /home/user/src/syslog-ng/build/../modules/afsocket/afsocket-source.c:1027:9
syslog-ng#3 0x7f343acb38bd in afsocket_sd_deinit_method /home/user/src/syslog-ng/build/../modules/afsocket/afsocket-source.c:1073:3
syslog-ng#4 0x7f343f2491d4 in log_pipe_deinit /home/user/src/syslog-ng/build/../lib/logpipe.h:316:25
syslog-ng#5 0x7f343f2490e5 in cfg_tree_stop /home/user/src/syslog-ng/build/../lib/cfg-tree.c:1439:12
syslog-ng#6 0x7f343f23b2d1 in cfg_deinit /home/user/src/syslog-ng/build/../lib/cfg.c:387:10
syslog-ng#7 0x7f343f271ec2 in main_loop_exit_finish /home/user/src/syslog-ng/build/../lib/mainloop.c:427:3
syslog-ng#8 0x7f343f273162 in _consume_action /home/user/src/syslog-ng/build/../lib/mainloop-worker.c:240:3
syslog-ng#9 0x7f343f27321f in _invoke_sync_call_actions /home/user/src/syslog-ng/build/../lib/mainloop-worker.c:250:7
syslog-ng#9 0x7f343f27321f in _invoke_sync_call_actions /home/user/src/syslog-ng/build/../lib/mainloop-worker.c:250:7
syslog-ng#10 0x7f343f2736ba in main_loop_worker_sync_call /home/user/src/syslog-ng/build/../lib/mainloop-worker.c:396:7
syslog-ng#11 0x7f343f2709d1 in main_loop_reload_config_commence /home/user/src/syslog-ng/build/../lib/mainloop.c:340:3
syslog-ng#12 0x7f343f275852 in control_connection_reload /home/user/src/syslog-ng/build/../lib/mainloop-control.c:167:3
syslog-ng#13 0x7f343f290c80 in control_connection_io_input /home/user/src/syslog-ng/build/../lib/control/control-server.c:378:3
syslog-ng#14 0x7f343efd4b2c (/usr/lib/libivykis.so.0+0x6b2c)
syslog-ng#15 0x7f343f239c50 in run_application_hook /home/user/src/syslog-ng/build/../lib/apphook.c:125:11
Signed-off-by: Kokan <[email protected]>
szemere
pushed a commit
that referenced
this pull request
Dec 15, 2020
This commit accumulates synthetic messages in an array, and forwards them after releasing the GroupingBy parser's lock. It is NOT allowed to call log_pipe_forward_msg() when locks are held, because it would slow down the entire pipeline, and it could also result in deadlock, for example: 1. A new message is produced in syslog-ng's worker pool, which goes through the parser, so it acquires GroupingBy::lock, and starts processing the message (continues in step 3). 2. The main thread schedules grouping_by_timer_tick(), which needs to hold GroupingBy::lock, so it blocks and waits for the other thread. 3. A new synthetic message is emitted in the worker thread (step 1). stateful_parser_emit_synthetic() is called in grouping_by_expire_entry(), which is protected by GroupingBy::lock, The message goes through the pipeline with this lock held, reaches a destination, where main_loop_call(wait=TRUE) is called. Worker waits for the main loop call to be scheduled and finished, main thread waits for GroupingBy::lock, which will never be released. A deadlock situation requires at least 2 locks: - one was GroupingBy::lock; - the other was main_task_lock and its GCond in main_loop_call(). Main thread: ``` #0 syscall () #1 g_mutex_lock_slowpath () #2 _grouping_by_timer_tick () #3 grouping_by_timer_tick () #4 iv_run_timers () #5 iv_main () #6 main_loop_run () #7 main () ``` Worker thread: ``` #0 syscall () #1 g_cond_wait () #2 main_loop_call () #3 ml_batched_timer_postpone () #4 log_writer_queue () #5 log_dest_driver_queue_method () #6 log_multiplexer_queue () #7 log_multiplexer_queue () #8 log_filter_pipe_queue () #9 stateful_parser_emit_synthetic () #10 grouping_by_expire_entry () #11 timer_wheel_set_time () #12 grouping_by_set_time () #13 grouping_by_process () ... ``` Important note: The unlock trick wouldn't have worked in the timer expire callback case, as we would be iterating through a non-locked data structure (TimerWheel) that could be modified by other threads. This commit is based on a00164c, which is a similar deadlock fix for PatternDB. Signed-off-by: László Várady <[email protected]>
HofiOne
pushed a commit
to HofiOne/syslog-ng
that referenced
this pull request
Jun 10, 2024
…ig-version collector: liveness probe and config version
This was referenced May 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes HP-UX, so it reads from /dev/log instead of /dev/pipe, and also from /dev/klog. With this patch, the system() source is in line with the version in PE.