File syslog-ng-HP-UX-100-CPU-spinning.diff of Package syslog-ng
From c40a607eb5e4b4c83a2a29c20dd64644174f30a7 Mon Sep 17 00:00:00 2001
From: Balazs Scheidler <bazsi@balabit.hu>
Date: Thu, 6 Nov 2008 11:53:32 +0100
Subject: [PATCH 1/2] fixed 100% CPU spinning on HP-UX upon a connection break
As I see the problem seems to be caused by the fact that HP-UX returns
POLLERR only without the other bits (e.g. POLLHUP) syslog-ng would
handle this gracefully if either the other bits would be set, or there'd
be some pending messages to send, in which case a normal write() error
would occur.
---
src/logwriter.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/logwriter.c b/src/logwriter.c
index bb82b43..7a5fcf7 100644
--- a/src/logwriter.c
+++ b/src/logwriter.c
@@ -139,6 +139,13 @@ log_writer_fd_dispatch(GSource *source,
log_writer_broken(self->writer, NC_CLOSE);
return FALSE;
}
+ else if (self->pollfd.revents & (G_IO_ERR))
+ {
+ msg_error("POLLERR occurred while idle",
+ evt_tag_int("fd", self->fd->fd),
+ NULL);
+ log_writer_broken(self->writer, NC_WRITE_ERROR);
+ }
else if (self->writer->queue->length || self->writer->partial)
{
if (!log_writer_flush_log(self->writer, self->fd))
--
1.6.4.2