[tracker/wal: 7/11] tracker-store: Never try to process more than 1 million events
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wal: 7/11] tracker-store: Never try to process more than 1 million events
- Date: Wed, 14 Jul 2010 13:00:39 +0000 (UTC)
commit f7c0a5d02257ddbb833b9dc21f7a99ddb6cf0821
Author: Jürg Billeter <j bitron ch>
Date: Thu Jul 1 16:17:22 2010 +0200
tracker-store: Never try to process more than 1 million events
This avoids extreme memory usage and D-Bus disconnects due to too large
messages.
src/tracker-store/tracker-events.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/tracker-store/tracker-events.c b/src/tracker-store/tracker-events.c
index 4359659..ae3064d 100644
--- a/src/tracker-store/tracker-events.c
+++ b/src/tracker-store/tracker-events.c
@@ -26,11 +26,13 @@
#include "tracker-events.h"
+#define MAX_EVENTS 1000000
typedef struct {
GHashTable *allowances;
GArray *events;
GStringChunk *chunk;
+ gboolean frozen;
} EventsPrivate;
static EventsPrivate *private;
@@ -93,6 +95,18 @@ tracker_events_insert (const gchar *uri,
g_return_if_fail (rdf_types || type != TRACKER_DBUS_EVENTS_TYPE_UPDATE);
g_return_if_fail (private != NULL);
+ if (private->frozen) {
+ return;
+ }
+
+ if (private->events && private->events->len > MAX_EVENTS) {
+ /* too many events would lead to high memory usage and to dbus signal messages
+ larger than maximum dbus message size, which results in dbus disconnect and tracker-store crash */
+ g_warning ("Too many events pending, disabling events for current transaction");
+ tracker_events_reset ();
+ private->frozen = TRUE;
+ }
+
if (rdf_types && type == TRACKER_DBUS_EVENTS_TYPE_UPDATE) {
guint i;
@@ -127,6 +141,7 @@ tracker_events_reset (void)
private->chunk = NULL;
private->events = NULL;
}
+ private->frozen = FALSE;
}
GArray *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]