On Sat, Oct 12, 2019 at 04:04:11PM +0800, Wang Yechao wrote:
libvirtd's stderr/stdout redirected to journald by default, so
if
the journald has stopped, libvirtd and libvirtd's child process
will receive SIGPIPE signal when writing logs to stderr/stdout.
journald stopped reasons:
1. manual command "systemctl stop systemd-journald.service"
Don't do that then IMHO.
2. oom killer kill it.
...
If OOM killer picked journald, then it is game over for the host IMHO
and thed right answer is a reboot. This would be very surprising though.
OOM killer is more likely to pick QEMU or libvirtd as they're bigger
targets.
Signed-off-by: Wang Yechao <wang.yechao255(a)zte.com.cn>
---
src/util/virlog.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/util/virlog.c b/src/util/virlog.c
index 4c76fbc..127e121 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -39,6 +39,7 @@
# include <sys/un.h>
#endif
#include <fnmatch.h>
+#include <signal.h>
#include "virerror.h"
#include "virlog.h"
@@ -732,6 +733,9 @@ virLogOutputToFd(virLogSourcePtr source ATTRIBUTE_UNUSED,
if (fd < 0)
return;
+ if (fd == STDERR_FILENO || fd == STDOUT_FILENO)
+ signal(SIGPIPE, SIG_IGN);
This is very wrong....
This code is run in both client & server, so we're messing with SIGPIPE
in applications that link to libvirt.so.
The use of signal() is not safe in multi-threaded applications.
In libvirtd we have set SIGPIPE to ignored already when starting up
libvirtd.
Regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|