]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add some values to OOM log msg #24501
authorFernando Fernandez Mancera <ffernandezmancera@gmail.com>
Wed, 20 Dec 2017 17:31:30 +0000 (18:31 +0100)
committerFernando Fernandez Mancera <ffernandezmancera@gmail.com>
Wed, 20 Dec 2017 17:31:30 +0000 (18:31 +0100)
Exposing cell_queues_get_total_allocation(), buf_get_total_allocation(),
tor_compress_get_total_allocation(), tor_compress_get_total_allocation() when
hit MaxMemInQueues threshold.

Fixes #24501

Signed-off-by: Fernando Fernandez Mancera <ffernandezmancera@gmail.com>
changes/ticket24501 [new file with mode: 0644]
src/or/circuitlist.c
src/or/relay.c
src/or/relay.h

diff --git a/changes/ticket24501 b/changes/ticket24501
new file mode 100644 (file)
index 0000000..4a87462
--- /dev/null
@@ -0,0 +1,3 @@
+  o Minor features (logging): 
+    - Make the log more quantitative when we hit MaxMemInQueues threshold
+      exposing some values. Closes ticket 24501.
index d442887c9e1b2eefba1b635291263125fc277f6f..c1b5c1a9515f71fe8b0ba4cfb667ecbfe218739f 100644 (file)
@@ -2329,9 +2329,15 @@ circuits_handle_oom(size_t current_allocation)
   int n_circuits_killed=0;
   int n_dirconns_killed=0;
   uint32_t now_ms;
-  log_notice(LD_GENERAL, "We're low on memory.  Killing circuits with "
-             "over-long queues. (This behavior is controlled by "
-             "MaxMemInQueues.)");
+  log_notice(LD_GENERAL, "We're low on memory (cell queues total alloc: %zu,"
+             " buffer total alloc: %zu, tor compress total alloc: %zu,"
+             " rendezvous cache total alloc: %zu). Killing circuits with"
+             " over-long queues. (This behavior is controlled by"
+             " MaxMemInQueues.)",
+             cell_queues_get_total_allocation(),
+             buf_get_total_allocation(),
+             tor_compress_get_total_allocation(),
+             rend_cache_get_total_allocation());
 
   {
     size_t mem_target = (size_t)(get_options()->MaxMemInQueues *
index 09f70793d3e2cfde7d2cf090823b1fb515a7401e..952622b6bf7bfa635cf1ae3756933c9334eec3a7 100644 (file)
@@ -2530,7 +2530,7 @@ packed_cell_mem_cost(void)
 }
 
 /* DOCDOC */
-STATIC size_t
+size_t
 cell_queues_get_total_allocation(void)
 {
   return total_cells_allocated * packed_cell_mem_cost();
index 2412dcb23c234e678575f4174473e50517058434..479ce5496b23bcfbff25680eeee46c7b222c1481 100644 (file)
@@ -17,6 +17,7 @@ extern uint64_t stats_n_relay_cells_delivered;
 
 int circuit_receive_relay_cell(cell_t *cell, circuit_t *circ,
                                cell_direction_t cell_direction);
+size_t cell_queues_get_total_allocation(void);
 
 void relay_header_pack(uint8_t *dest, const relay_header_t *src);
 void relay_header_unpack(relay_header_t *dest, const uint8_t *src);
@@ -102,7 +103,6 @@ STATIC int connection_edge_process_resolved_cell(edge_connection_t *conn,
                                                  const relay_header_t *rh);
 STATIC packed_cell_t *packed_cell_new(void);
 STATIC packed_cell_t *cell_queue_pop(cell_queue_t *queue);
-STATIC size_t cell_queues_get_total_allocation(void);
 STATIC int cell_queues_check_size(void);
 #endif /* defined(RELAY_PRIVATE) */