diff options
5 files changed, 136 insertions, 48 deletions
diff --git a/meta-oe/recipes-support/syslog-ng/files/logwriter-dont-allocate-a-new-buffer.patch b/meta-oe/recipes-support/syslog-ng/files/logwriter-dont-allocate-a-new-buffer.patch new file mode 100644 index 0000000000..9e3d64bbf2 --- /dev/null +++ b/meta-oe/recipes-support/syslog-ng/files/logwriter-dont-allocate-a-new-buffer.patch | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | logwriter: Don't allocate a new buffer if fails to consume current item | ||
| 2 | |||
| 3 | Upstream-Status: Pending | ||
| 4 | |||
| 5 | Signed-off-by: Xufeng Zhang <xufeng.zhang@windriver.com> | ||
| 6 | --- | ||
| 7 | --- a/lib/logwriter.c | ||
| 8 | +++ b/lib/logwriter.c | ||
| 9 | @@ -1010,7 +1010,7 @@ | ||
| 10 | { | ||
| 11 | status = log_proto_client_post(proto, (guchar *) self->line_buffer->str, self->line_buffer->len, &consumed); | ||
| 12 | |||
| 13 | - if (consumed) | ||
| 14 | + if (consumed && status != LPS_ERROR) | ||
| 15 | log_writer_realloc_line_buffer(self); | ||
| 16 | |||
| 17 | if (status == LPS_ERROR) | ||
| 18 | @@ -1028,7 +1028,7 @@ | ||
| 19 | NULL); | ||
| 20 | consumed = TRUE; | ||
| 21 | } | ||
| 22 | - if (consumed) | ||
| 23 | + if (consumed && status != LPS_ERROR) | ||
| 24 | { | ||
| 25 | if (lm->flags & LF_LOCAL) | ||
| 26 | step_sequence_number(&self->seq_num); | ||
diff --git a/meta-oe/recipes-support/syslog-ng/files/logwriter-still-free-the-unconsumed-item.patch b/meta-oe/recipes-support/syslog-ng/files/logwriter-still-free-the-unconsumed-item.patch deleted file mode 100644 index 31110933f0..0000000000 --- a/meta-oe/recipes-support/syslog-ng/files/logwriter-still-free-the-unconsumed-item.patch +++ /dev/null | |||
| @@ -1,47 +0,0 @@ | |||
| 1 | logwritter: still free the unconsumed item during reloading configuration | ||
| 2 | |||
| 3 | Otherwise we have no chance to free this stuff. | ||
| 4 | |||
| 5 | Upstream-Status: Pending | ||
| 6 | |||
| 7 | Signed-off-by: Xufeng Zhang <xufeng.zhang@windriver.com> | ||
| 8 | --- | ||
| 9 | --- a/lib/logwriter.c | ||
| 10 | +++ b/lib/logwriter.c | ||
| 11 | @@ -39,6 +39,7 @@ | ||
| 12 | #include <iv.h> | ||
| 13 | #include <iv_event.h> | ||
| 14 | #include <iv_work.h> | ||
| 15 | +#include "logproto/logproto-text-client.h" | ||
| 16 | |||
| 17 | typedef enum | ||
| 18 | { | ||
| 19 | @@ -978,6 +979,7 @@ | ||
| 20 | gint count = 0; | ||
| 21 | gboolean ignore_throttle = (flush_mode >= LW_FLUSH_QUEUE); | ||
| 22 | LogProtoStatus status = LPS_SUCCESS; | ||
| 23 | + LogProtoTextClient *self_text; | ||
| 24 | |||
| 25 | if (!proto) | ||
| 26 | return FALSE; | ||
| 27 | @@ -1035,7 +1037,18 @@ | ||
| 28 | } | ||
| 29 | else | ||
| 30 | { | ||
| 31 | - /* push back to the queue */ | ||
| 32 | - log_queue_push_head(self->queue, lm, &path_options); | ||
| 33 | + self_text = (LogProtoTextClient *) proto; | ||
| 34 | + /* free the unconsumed message during reloading configuration */ | ||
| 35 | + if ((LW_FLUSH_QUEUE == flush_mode) && self_text->partial_free && self_text->partial) | ||
| 36 | + { | ||
| 37 | + self_text->partial_free(self_text->partial); | ||
| 38 | + self_text->partial = NULL; | ||
| 39 | + log_msg_unref(lm); | ||
| 40 | + } | ||
| 41 | + else | ||
| 42 | + { | ||
| 43 | + /* push back to the queue */ | ||
| 44 | + log_queue_push_head(self->queue, lm, &path_options); | ||
| 45 | + } | ||
| 46 | msg_set_context(NULL); | ||
| 47 | log_msg_refcache_stop(); | ||
diff --git a/meta-oe/recipes-support/syslog-ng/files/rewrite-expr-grammar.ym-Free-up-token.patch b/meta-oe/recipes-support/syslog-ng/files/rewrite-expr-grammar.ym-Free-up-token.patch new file mode 100644 index 0000000000..1951af9fcc --- /dev/null +++ b/meta-oe/recipes-support/syslog-ng/files/rewrite-expr-grammar.ym-Free-up-token.patch | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | rewrite-expr-grammar.ym: Free up token. | ||
| 2 | |||
| 3 | Upsteam-Status: Backport | ||
| 4 | |||
| 5 | Reported-by: Xufeng Zhang <xufeng.zhang@windriver.com> | ||
| 6 | Signed-off-by: Viktor Tusa <tusavik@gmail.com> | ||
| 7 | --- | ||
| 8 | --- a/lib/rewrite/rewrite-expr-grammar.ym | ||
| 9 | +++ b/lib/rewrite/rewrite-expr-grammar.ym | ||
| 10 | @@ -78,6 +78,7 @@ | ||
| 11 | |||
| 12 | $$ = log_template_new(configuration, $1); | ||
| 13 | CHECK_ERROR(log_template_compile($$, $1, &error), @1, "Error compiling template (%s)", error->message); | ||
| 14 | + free($1); | ||
| 15 | } | ||
| 16 | ; | ||
| 17 | |||
diff --git a/meta-oe/recipes-support/syslog-ng/files/still-free-the-unconsumed-item.patch b/meta-oe/recipes-support/syslog-ng/files/still-free-the-unconsumed-item.patch new file mode 100644 index 0000000000..ea18682300 --- /dev/null +++ b/meta-oe/recipes-support/syslog-ng/files/still-free-the-unconsumed-item.patch | |||
| @@ -0,0 +1,90 @@ | |||
| 1 | From 365020c5c0823c91a8011e34597f970a7cfb4fb3 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Tusa Viktor <tusavik@gmail.com> | ||
| 3 | Date: Wed, 23 Apr 2014 17:10:58 +0000 | ||
| 4 | Subject: [PATCH] logwriter: still free the unconsumed item during reloading | ||
| 5 | configuration | ||
| 6 | |||
| 7 | Upstream-Status: Backport | ||
| 8 | |||
| 9 | Otherwise we have no chance to free this stuff. | ||
| 10 | |||
| 11 | Reported-by: Xufeng Zhang <xufeng.zhang@windriver.com> | ||
| 12 | Signed-off-by: Tusa Viktor <tusavik@gmail.com> | ||
| 13 | Signed-off-by: Gergely Nagy <algernon@madhouse-project.org> | ||
| 14 | --- | ||
| 15 | lib/logproto/logproto-client.h | 2 +- | ||
| 16 | lib/logproto/logproto-text-client.c | 11 +++++++++++ | ||
| 17 | lib/logwriter.c | 9 +++++++-- | ||
| 18 | 3 files changed, 19 insertions(+), 3 deletions(-) | ||
| 19 | |||
| 20 | diff --git a/lib/logproto/logproto-client.h b/lib/logproto/logproto-client.h | ||
| 21 | index 254ecf9..5adc917 100644 | ||
| 22 | --- a/lib/logproto/logproto-client.h | ||
| 23 | +++ b/lib/logproto/logproto-client.h | ||
| 24 | @@ -47,7 +47,6 @@ void log_proto_client_options_defaults(LogProtoClientOptions *options); | ||
| 25 | void log_proto_client_options_init(LogProtoClientOptions *options, GlobalConfig *cfg); | ||
| 26 | void log_proto_client_options_destroy(LogProtoClientOptions *options); | ||
| 27 | |||
| 28 | - | ||
| 29 | struct _LogProtoClient | ||
| 30 | { | ||
| 31 | LogProtoStatus status; | ||
| 32 | @@ -107,6 +106,7 @@ log_proto_client_reset_error(LogProtoClient *s) | ||
| 33 | gboolean log_proto_client_validate_options(LogProtoClient *self); | ||
| 34 | void log_proto_client_init(LogProtoClient *s, LogTransport *transport, const LogProtoClientOptions *options); | ||
| 35 | void log_proto_client_free(LogProtoClient *s); | ||
| 36 | +void log_proto_client_free_method(LogProtoClient *s); | ||
| 37 | |||
| 38 | #define DEFINE_LOG_PROTO_CLIENT(prefix) \ | ||
| 39 | static gpointer \ | ||
| 40 | diff --git a/lib/logproto/logproto-text-client.c b/lib/logproto/logproto-text-client.c | ||
| 41 | index 3248759..a5100f3 100644 | ||
| 42 | --- a/lib/logproto/logproto-text-client.c | ||
| 43 | +++ b/lib/logproto/logproto-text-client.c | ||
| 44 | @@ -146,12 +146,23 @@ log_proto_text_client_post(LogProtoClient *s, guchar *msg, gsize msg_len, gboole | ||
| 45 | } | ||
| 46 | |||
| 47 | void | ||
| 48 | +log_proto_text_client_free(LogProtoClient *s) | ||
| 49 | +{ | ||
| 50 | + LogProtoTextClient *self = (LogProtoTextClient *)s; | ||
| 51 | + if (self->partial_free) | ||
| 52 | + self->partial_free(self->partial); | ||
| 53 | + self->partial = NULL; | ||
| 54 | + log_proto_client_free_method(s); | ||
| 55 | +}; | ||
| 56 | + | ||
| 57 | +void | ||
| 58 | log_proto_text_client_init(LogProtoTextClient *self, LogTransport *transport, const LogProtoClientOptions *options) | ||
| 59 | { | ||
| 60 | log_proto_client_init(&self->super, transport, options); | ||
| 61 | self->super.prepare = log_proto_text_client_prepare; | ||
| 62 | self->super.flush = log_proto_text_client_flush; | ||
| 63 | self->super.post = log_proto_text_client_post; | ||
| 64 | + self->super.free_fn = log_proto_text_client_free; | ||
| 65 | self->super.transport = transport; | ||
| 66 | self->next_state = -1; | ||
| 67 | } | ||
| 68 | diff --git a/lib/logwriter.c b/lib/logwriter.c | ||
| 69 | index 3292e31..470bcdb 100644 | ||
| 70 | --- a/lib/logwriter.c | ||
| 71 | +++ b/lib/logwriter.c | ||
| 72 | @@ -1063,8 +1063,13 @@ log_writer_flush(LogWriter *self, LogWriterFlushMode flush_mode) | ||
| 73 | } | ||
| 74 | else | ||
| 75 | { | ||
| 76 | - /* push back to the queue */ | ||
| 77 | - log_queue_push_head(self->queue, lm, &path_options); | ||
| 78 | + if (flush_mode == LW_FLUSH_QUEUE) | ||
| 79 | + log_msg_unref(lm); | ||
| 80 | + else | ||
| 81 | + { | ||
| 82 | + /* push back to the queue */ | ||
| 83 | + log_queue_push_head(self->queue, lm, &path_options); | ||
| 84 | + } | ||
| 85 | msg_set_context(NULL); | ||
| 86 | log_msg_refcache_stop(); | ||
| 87 | break; | ||
| 88 | -- | ||
| 89 | 1.7.10.4 | ||
| 90 | |||
diff --git a/meta-oe/recipes-support/syslog-ng/syslog-ng_3.5.4.1.bb b/meta-oe/recipes-support/syslog-ng/syslog-ng_3.5.4.1.bb index d5939e4623..b54842030c 100644 --- a/meta-oe/recipes-support/syslog-ng/syslog-ng_3.5.4.1.bb +++ b/meta-oe/recipes-support/syslog-ng/syslog-ng_3.5.4.1.bb | |||
| @@ -9,10 +9,12 @@ SRC_URI += " \ | |||
| 9 | file://Fix-the-memory-leak-problem-for-mutex.patch \ | 9 | file://Fix-the-memory-leak-problem-for-mutex.patch \ |
| 10 | file://Fix-the-memory-leak-problem-when-HAVE_ENVIRON-defined.patch \ | 10 | file://Fix-the-memory-leak-problem-when-HAVE_ENVIRON-defined.patch \ |
| 11 | file://free-global-LogTemplateOptions.patch \ | 11 | file://free-global-LogTemplateOptions.patch \ |
| 12 | file://logwriter-still-free-the-unconsumed-item.patch \ | 12 | file://still-free-the-unconsumed-item.patch \ |
| 13 | file://syslog-ng-verify-the-list-before-del.patch \ | 13 | file://syslog-ng-verify-the-list-before-del.patch \ |
| 14 | file://configure.patch \ | 14 | file://configure.patch \ |
| 15 | file://dbifix.patch \ | 15 | file://dbifix.patch \ |
| 16 | file://rewrite-expr-grammar.ym-Free-up-token.patch \ | ||
| 17 | file://logwriter-dont-allocate-a-new-buffer.patch \ | ||
| 16 | " | 18 | " |
| 17 | 19 | ||
| 18 | SRC_URI[md5sum] = "ff3bf223ebafbaa92b69a2d5b729f368" | 20 | SRC_URI[md5sum] = "ff3bf223ebafbaa92b69a2d5b729f368" |
