[syslog-ng] [Bug 142] --worker-threads=0 support

bugzilla at bugzilla.balabit.com bugzilla at bugzilla.balabit.com
Fri Nov 4 09:03:54 CET 2011


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





--- Comment #5 from Arkadiusz Miśkiewicz <arekm at maven.pl>  2011-11-04 09:03:54 ---
Is _everything_ related to destination running in a separate thread?

Are there no things like stat() or something happening before
thread creation when a new log is going to be send to the destination?


I've tried to look with gdb at what's happening but as soon as I get D-state
I'm unable to interrupt a process in gdb.

I've tried to send SIGABRT to syslog-ng but it only worked when I made D-state
go away, then logged this below.

(gdb) set follow-fork-mode child                                                                                                                             
(gdb) r                                                                                                                                                      
Starting program: /sbin/syslog-ng -f /etc/syslog-ng/syslog-ng.conf --worker-threads=1024                                                                     
[Thread debugging using libthread_db enabled]                                                                                                                
[New process 5375]                                                                                                                                           
[Thread debugging using libthread_db enabled]                                                                                                                
[New process 5376]                                                                                                                                           
[Thread debugging using libthread_db enabled]                                                                                                                
Missing separate debuginfo for /lib/libwrap.so.0                                                                                                             
Try to install package that provides `/usr/lib/debug/.build-id/22/bae42ce43bbb05b35ba52797f0f05a38548c86.debug' file                                         
WARNING: window sizing for tcp sources were changed in syslog-ng 3.3, the configuration value was divided by the value of max-connections(). The result was too
small, clamping to 100 entries. Ensure you have a proper log_fifo_size setting to avoid message loss.; orig_log_iw_size='25', new_log_iw_size='100',
min_log_fifo_size='100000'                                                                                                                                      
[New Thread 0xb7a89b70 (LWP 5377)]                                                                                                                           

Program received signal SIGABRT, Aborted.                                                                                                                    
[Switching to Thread 0xb7d74180 (LWP 5376)]                                                                                                                  
0xb7fde430 in __kernel_vsyscall ()                                                                                                                           
(gdb) bt                                                                                                                                                     
#0  0xb7fde430 in __kernel_vsyscall ()                                                                                                                       
#1  0xb7e38c66 in __xstat64 () from /lib/libc.so.6                                                                                                           
#2  0xb7d6a3ef in stat64 () from /lib/syslog-ng/libaffile.so                                                                                                 
#3  0xb7d655c7 in affile_open_file (name=0x81a7888 "/mnt/test/messages", flags=35137, uid=0, gid=124, mode=416, dir_uid=0, dir_gid=124, dir_mode=488,        
    create_dirs=1, privileged=0, is_pipe=0, fd=0xbffff594) at affile.c:76                                                                                    
#4  0xb7d66793 in affile_dw_reopen (self=0x81a77e0) at affile.c:540                                                                                          
#5  0xb7d66afa in affile_dw_init (s=0x81a77e0) at affile.c:605                                                                                               
#6  0xb7d6523c in log_pipe_init (s=0x81a77e0, cfg=0x81a1910) at ../../lib/logpipe.h:239                                                                      
#7  0xb7d67a3a in affile_dd_open_writer (args=0xb7a86f1c) at affile.c:1011
#8  0xb7f75ff4 in main_loop_call_handler (user_data=0x0) at mainloop.c:199
#9  0x0810c7ac in iv_event_run_pending_events (_dummy=0x0) at iv_event.c:67
#10 0x0810cb6d in iv_event_raw_got_event (_this=0xb7d7409c) at iv_event_raw.c:82
#11 0x08109cc6 in iv_run_active_list (active=0xbffffb44) at iv_main.c:219
#12 0x08109e85 in iv_main () at iv_main.c:269
#13 0xb7f771da in main_loop_run () at mainloop.c:722
#14 0x0805ea0a in main (argc=1, argv=0xbffffc44) at main.c:260
(gdb) info threads
  4 Thread 0xb7a89b70 (LWP 5377)  0xb7fde430 in __kernel_vsyscall ()
* 3 Thread 0xb7d74180 (LWP 5376)  0xb7fde430 in __kernel_vsyscall ()
(gdb) thread 4
[Switching to thread 4 (Thread 0xb7a89b70 (LWP 5377))]#0  0xb7fde430 in __kernel_vsyscall ()
(gdb) bt
#0  0xb7fde430 in __kernel_vsyscall ()
#1  0xb7f0231c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0xb7f75e8a in main_loop_call (func=0xb7d679ad <affile_dd_open_writer>, user_data=0xb7a86f1c, wait=1) at mainloop.c:180
#3  0xb7d67deb in affile_dd_queue (s=0x81bf640, msg=0xb7105d10, path_options=0xb7a86fcc, user_data=0x0) at affile.c:1092
#4  0xb7f5c52e in log_pipe_queue (s=0x81bf640, msg=0xb7105d10, path_options=0xb7a86fcc) at logpipe.h:288
#5  0xb7f5c94b in log_dest_group_queue (s=0x81bf790, msg=0xb7105d10, path_options=0xb7a86fcc, user_data=0x0) at dgroup.c:97
#6  0xb7f643bc in log_pipe_queue (s=0x81bf790, msg=0xb7105d10, path_options=0xb7a86fcc) at logpipe.h:288
#7  0xb7f645fe in log_multiplexer_queue (s=0x81a5c48, msg=0xb7105d10, path_options=0xb7a8703c, user_data=0x0) at logmpx.c:125
#8  0xb7f643bc in log_pipe_queue (s=0x81a5c48, msg=0xb7105d10, path_options=0xb7a8703c) at logpipe.h:288
#9  0xb7f645fe in log_multiplexer_queue (s=0x81a21e0, msg=0xb7105d10, path_options=0xb7a871e8, user_data=0x0) at logmpx.c:125
#10 0xb7f7ea76 in log_pipe_queue (s=0x81a21e0, msg=0xb7105d10, path_options=0xb7a871e8) at logpipe.h:288
#11 0xb7f7ea26 in log_pipe_forward_msg (self=0x81bf348, msg=0xb7105d10, path_options=0xb7a871e8) at logpipe.h:275
#12 0xb7f7eee4 in log_source_group_queue (s=0x81bf348, msg=0xb7105d10, path_options=0xb7a871e8, user_data=0x0) at sgroup.c:102
#13 0xb7f70718 in log_pipe_queue (s=0x81bf348, msg=0xb7105d10, path_options=0xb7a871e8) at logpipe.h:288
#14 0xb7f706c8 in log_pipe_forward_msg (self=0x81bf158, msg=0xb7105d10, path_options=0xb7a871e8) at logpipe.h:275
#15 0xb7f70733 in log_pipe_queue (s=0x81bf158, msg=0xb7105d10, path_options=0xb7a871e8) at logpipe.h:292
#16 0xb7f706c8 in log_pipe_forward_msg (self=0x81a8690, msg=0xb7105d10, path_options=0xb7a871e8) at logpipe.h:275
#17 0xb7f70733 in log_pipe_queue (s=0x81a8690, msg=0xb7105d10, path_options=0xb7a871e8) at logpipe.h:292
#18 0xb7f706c8 in log_pipe_forward_msg (self=0x81a8848, msg=0xb7105d10, path_options=0xb7a871e8) at logpipe.h:275
#19 0xb7f712b1 in log_source_queue (s=0x81a8848, msg=0xb7105d10, path_options=0xb7a87254, user_data=0x0) at logsource.c:288
#20 0xb7f6e3ec in log_pipe_queue (s=0x81a8848, msg=0xb7105d10, path_options=0xb7a87254) at logpipe.h:288
#21 0xb7f6ef9f in log_reader_handle_line (self=0x81a8848, line=0xb7106048 "<189>Nov  4 08:55:44 crond: crond shutdown  succeeded", length=53, saddr=0x0)
    at logreader.c:503
#22 0xb7f6f0d1 in log_reader_fetch_log (self=0x81a8848) at logreader.c:561
#23 0xb7f6e495 in log_reader_work_perform (s=0x81a8848) at logreader.c:115
#24 0xb7f766eb in main_loop_io_worker_job_start (self=0x81a89ac) at mainloop.c:358
#25 0x0810e8d0 in iv_work_thread_got_event (_thr=0x81a8210) at iv_work.c:113
#26 0x0810c7ac in iv_event_run_pending_events (_dummy=0x0) at iv_event.c:67
#27 0x0810cb6d in iv_event_raw_got_event (_this=0xb7a89a8c) at iv_event_raw.c:82
#28 0x08109cc6 in iv_run_active_list (active=0xb7a87834) at iv_main.c:219
#29 0x08109e85 in iv_main () at iv_main.c:269
#30 0x0810ebb1 in iv_work_thread (_thr=0x81a8210) at iv_work.c:196
#31 0x0810dad3 in iv_thread_handler (_thr=0x81a8278) at iv_thread.c:100
#32 0xb7efea30 in start_thread () from /lib/libpthread.so.0
#33 0xb7e4ad9e in clone () from /lib/libc.so.6
(gdb)


ps. here is how I'm testing this.

/mnt/test is mounted over NFS from other machine
/var/log/user is local disk.

I expect /var/log/user to always work, even if /mnt/test gets D-state. I'm logging things
to it via "logger qq".

D-state is made by iptables -I INPUT -s IP-of-syslog-ng-host -j DROP on the nfs server.

Now scenario:
- logger qq -> gets logged into /var/log/user
- iptables .. -j DROP
- logger qq2 -> ges logged fine (most likely because nothing tried to log into /mnt/test yet)
- service crond restart -> tries to log into /mnt/test/...
- logger qq3 -> nothing gets logged into /var/log/user -> things are waiting for something


# more /etc/syslog-ng/syslog-ng.conf                                                                                                            
@version: 3.3                                                                                                                                                
#                                                                                                                                                            
# Syslog-ng configuration for PLD Linux                                                                                                                      
#                                                                                                                                                            
# See syslog-ng(8) and syslog-ng.conf(5) for more information.                                                                                               
#                                                                                                                                                            

options {                                                                                                                                                    
        flush_lines(0);                                                                                                                                      
        owner(root);                                                                                                                                         
        group(logs);                                                                                                                                         
        perm(0640);                                                                                                                                          
        create_dirs(yes);                                                                                                                                    
        dir_owner(root);                                                                                                                                     
        dir_group(logs);                                                                                                                                     
        dir_perm(0750);                                                                                                                                      
        stats_freq(3600);                                                                                                                                    
        time_reopen(10);                                                                                                                                     
        time_reap(360);                                                                                                                                      
        mark_freq(600);                                                                                                                                      
        threaded(yes);                                                                                                                                       
};                                                                                                                                                           

source s_sys    {                                                                                                                                            
        file ("/proc/kmsg" program_override("kernel"));                                                                                                      
        unix-stream("/dev/log" max-connections(1000));                                                                                                       
        internal();                                                                                                                                          
};                                                                                                                                                           

# uncomment the line below if you want to setup syslog server                                                                                                
#source s_net   { udp(); };                                                                                                                                  

#destination d_loghost  { udp("loghost" port(514)); };                                                                                                       

destination d_kern      { file("/mnt/test/kernel"); };                                                                                                       
destination d_messages  { file("/mnt/test/messages"); };                                                                                                     
destination d_authlog   { file("/mnt/test/secure"); };                                                                                                       
destination d_mail      { file("/mnt/test/maillog"); };                                                                                                      
destination d_uucp      { file("/mnt/test/spooler"); };                                                                                                      
destination d_debug     { file("/mnt/test/debug"); };                                                                                                        
#destination d_cron     { file("/var/log/cron" owner(root) group(crontab) perm(0660)); };                                                                    
destination d_cron      { file("/mnt/test/cron" owner(root) group(crontab) perm(0660)); };                                                                   
destination d_syslog    { file("/mnt/test/syslog"); };                                                                                                       
destination d_daemon    { file("/mnt/test/daemon"); };                                                                                                       
destination d_lpr               { file("/var/log/lpr"); };                                                                                                   
destination d_user      { file("/var/log/user"); };                                                                                                          
destination d_ppp               { file("/var/log/ppp"); };                                                                                                   
destination d_ftp               { file("/var/log/xferlog"); };                                                                                               
destination d_audit     { file("/var/log/audit"); };                                                                                                         
destination d_postgres  { file("/var/log/pgsql"); };                                                                                                         
destination d_freshclam { file("/var/log/freshclam.log"); };                                                                                                 

# Log iptables messages to separate file                                                                                                                     
destination d_iptables  { file("/mnt/test/iptables"); };                                                                                                     

destination d_console   { usertty("root"); };                                                                                                                
#destination d_console_all      { file("/dev/tty12"); };                                                                                                     

destination d_xconsole  { pipe("/dev/xconsole"); };                                                                                                          

destination d_newscrit  { file("/var/log/news/news.crit" owner(news) group(news)); };                                                                        
destination d_newserr   { file("/var/log/news/news.err" owner(news) group(news)); };                                                                         
destination d_newsnotice        { file("/var/log/news/news.notice" owner(news) group(news)); };                                                              

# Filters for standard syslog(3) facilities                                                                                                                  
#filter f_audit         { facility(audit); };                                                                                                                
filter f_authpriv       { facility(authpriv, auth); };                                                                                                       
filter f_cron           { facility(cron); };                                                                                                                 
filter f_daemon         { facility(daemon); };                                                                                                               
filter f_ftp            { facility(ftp); };                                                                                                                  
filter f_kern           { facility(kern); };                                                                                                                 
filter f_lpr            { facility(lpr); };                                                                                                                  
filter f_mail           { facility(mail); };                                                                                                                 
filter f_news           { facility(news); };                                                                                                                 
filter f_syslog         { facility(syslog); };                                                                                                               
filter f_user           { facility(user); };                                                                                                                 
filter f_uucp           { facility(uucp); };                                                                                                                 
filter f_local0         { facility(local0); };                                                                                                               
filter f_local1         { facility(local1); };                                                                                                               
filter f_local2         { facility(local2); };                                                                                                               
filter f_local3         { facility(local3); };                                                                                                               
filter f_local4         { facility(local4); };                                                                                                               
filter f_local5         { facility(local5); };                                                                                                               
filter f_local6         { facility(local6); };                                                                                                               
filter f_local7         { facility(local7); };                                                                                                               

# Filters for standard syslog(3) priorities                                                                                                                  
filter p_debug          { level(debug); };
filter p_info           { level(info); };
filter p_notice         { level(notice); };
filter p_warn           { level(warn); };
filter p_err            { level(err); };
filter p_alert          { level(alert); };
filter p_crit           { level(crit); };
filter p_emergency      { level(emerg); };

# Additional filters for specific programs/use
filter f_freshclam      { program(freshclam); };
filter f_ppp            { program(pppd) or program(chat); };
filter f_postgres       { program(postgres); };
filter f_iptables       { match("IN=[A-Za-z0-9\.]* OUT=[A-Za-z0-9\.]*" value("MESSAGE")); };

log { source(s_sys); filter(f_authpriv);        destination(d_authlog); };
log { source(s_sys); filter(f_cron);            destination(d_cron); };
log { source(s_sys); filter(f_daemon);          destination(d_daemon); };
log { source(s_sys); filter(f_ftp);             destination(d_ftp); };
log { source(s_sys); filter(f_kern);            destination(d_kern); };
log { source(s_sys); filter(f_lpr);             destination(d_lpr); };
log { source(s_sys); filter(f_mail);                    destination(d_mail); };
log { source(s_sys); filter(f_news); filter(p_crit);    destination(d_uucp); };
log { source(s_sys); filter(f_news); filter(p_crit);    destination(d_newscrit); };
log { source(s_sys); filter(f_news); filter(p_err);     destination(d_newserr); };
log { source(s_sys); filter(f_news); filter(p_warn);    destination(d_newsnotice); };
log { source(s_sys); filter(f_news); filter(p_notice);  destination(d_newsnotice); };
log { source(s_sys); filter(f_news); filter(p_info);    destination(d_newsnotice); };
log { source(s_sys); filter(f_news); filter(p_debug);   destination(d_newsnotice); };
log { source(s_sys); filter(f_syslog);          destination(d_syslog); };
log { source(s_sys); filter(f_user);            destination(d_user); };
log { source(s_sys); filter(f_uucp);            destination(d_uucp); };

log { source(s_sys); filter(p_debug);           destination(d_debug); };

log { source(s_sys); filter(f_daemon); filter(f_ppp);           destination(d_ppp); };
log { source(s_sys); filter(f_local6); filter(f_freshclam);     destination(d_freshclam); };
log { source(s_sys); filter(f_local0); filter(f_postgres);      destination(d_postgres); };
#log { source(s_sys); filter(f_iptables);       destination(d_iptables); };

log { source(s_sys); filter(p_emergency);       destination(d_console); };
#log { source(s_sys); destination(d_console_all); };

#  This is a catchall statement, and should catch all messages which were not
#  accepted any of the previous statements.
log { source(s_sys); destination(d_messages); flags(fallback); };

# Network syslogging
#log { source(s_sys); destination(d_loghost); };


-- 
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