Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syslog-ng 3.6 may kill init process #586

Closed
ghost opened this issue Jul 24, 2015 · 5 comments
Closed

syslog-ng 3.6 may kill init process #586

ghost opened this issue Jul 24, 2015 · 5 comments
Labels

Comments

@ghost
Copy link

ghost commented Jul 24, 2015

If a destination program exits right before syslog-ng wants to terminate it, syslog-ng terminates init process instead of the program. If init process is immutable to TERM signal, on Ubuntu for example, it is not a problem. But otherwise you are in trouble, system goes down.

Tested on FreeBSD 8.4-p19 and FreeBSD 8.4-p34.
Syslog-ng 3.6.2 and 3.6.4 installed from freebsd package repository.
Hardware: HP Proliant DL380G5

CPU: Intel(R) Xeon(R) CPU E5440 @ 2.83GHz (2833.35-MHz K8-class CPU)
Origin = "GenuineIntel" Id = 0x10676 Family = 6 Model = 17 Stepping = 6
Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
Features2=0xce3bd<SSE3,DTES64,MON,DS_CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,DCA,SSE4.1>
AMD Features=0x20100800<SYSCALL,NX,LM>
AMD Features2=0x1
TSC: P-state invariant
real memory = 4294967296 (4096 MB)
avail memory = 4097650688 (3907 MB)
ACPI APIC Table:
FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
FreeBSD/SMP: 1 package(s) x 4 core(s)
cpu0 (BSP): APIC ID: 0
cpu1 (AP): APIC ID: 1
cpu2 (AP): APIC ID: 2
cpu3 (AP): APIC ID: 3

root@freebsd:~# uname -a
FreeBSD freebsd.local 8.4-RELEASE-p19 FreeBSD 8.4-RELEASE-p19 #0: Mon Nov 3 17:12:38 UTC 2014 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64

Configuration 1:
=== BEGIN =====
@Version: 3.6
@include "scl.conf"

source s_local { system(); internal(); };
destination d_local { program("not-existent-path"); }; # Trigger on stop, restart or reload
destination d_local1 { program("/usr/bin/true"); }; # Trigger on stop, restart or reload
log { source(s_local); destination(d_local); };
=== END ===

root@freebsd:# /usr/local/etc/rc.d/syslog-ng start
Starting syslog_ng.
root@freebsd:
# /usr/local/etc/rc.d/syslog-ng reload # or restart, or stop
root@freebsd:~# Writing entropy file:.
Terminated
.
Enter full pathname of shell or RETURN for /bin/sh:

It may need a few syslog-ng reloads to trigger the issue.
Same effect is on restart and stop.

Configuration 2:
=== BEGIN =====
@Version: 3.6
@include "scl.conf"

source s_local { system(); internal(); };
destination d_local { program("/bin/cat"); }; # Trigger on "killall -1 cat syslog-ng"
log { source(s_local); destination(d_local); };
=== END ===

root@freebsd:# /usr/local/etc/rc.d/syslog-ng start
Starting syslog_ng.
root@freebsd:
# killall -1 cat syslog-ng
root@freebsd:~# Writing entropy file:.
Terminated
.
Enter full pathname of shell or RETURN for /bin/sh:

It seems no problem with source programs.
It seems no problem with syslog-ng 3.5.
Other syslog-ng releases was not tested.

@bazsi
Copy link
Collaborator

bazsi commented Jul 24, 2015

seems to be caused by this patch:

37fd7fd

probably the getpgid() call fails, returns -1 which in turn means to kill the process group of the entire init process.

It must have been difficult to diagnose, thanks for the effort and the report.

@lbudai
Copy link
Collaborator

lbudai commented Jul 24, 2015

hmm.. I think you are right.
I'll setup a fix for this problem.

lbudai added a commit to lbudai/syslog-ng that referenced this issue Jul 25, 2015
Fixes: syslog-ng#586

Signed-off-by: Laszlo Budai <stentor.bgyk@gmail.com>
@lbudai
Copy link
Collaborator

lbudai commented Jul 25, 2015

@mcmurphy75 : #590 should solve the problem

@ihrwein
Copy link
Contributor

ihrwein commented Jul 28, 2015

@mcmurphy75 The fix for this issue has been merged (#590). Could you close this issue?

@ghost
Copy link
Author

ghost commented Jul 29, 2015

Unfortunately I have no development system to test the fix in my environment, but unchecked getpgid really looks like a cause of the problem. Good work. Thanks.

@ghost ghost closed this as completed Jul 29, 2015
ihrwein pushed a commit to ihrwein/syslog-ng that referenced this issue Aug 10, 2015
Fixes: syslog-ng#586

Signed-off-by: Laszlo Budai <stentor.bgyk@gmail.com>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants