When we hit MaxMemInQueues, make the log message more quantitative
A relay operator on #tor shared these log lines, on a fast exit relay running with 1GByte of memory (so maxmeminqueues is 768MBytes):
Nov 30 03:13:52.000 [notice] We're low on memory. Killing circuits with over-long queues. (This behavior is controlled by MaxMemInQueues.)
Nov 30 03:13:52.000 [notice] Removed 118288 bytes by killing 124 circuits; 0 circuits remain alive. Also killed 0 non-linked directory connections.
Nov 30 03:13:52.000 [notice] We're low on memory. Killing circuits with over-long queues. (This behavior is controlled by MaxMemInQueues.)
Nov 30 03:13:52.000 [notice] Removed 25940496 bytes by killing 125 circuits; 0 circuits remain alive. Also killed 0 non-linked directory connections.
Nov 30 03:13:53.000 [notice] We're low on memory. Killing circuits with over-long queues. (This behavior is controlled by MaxMemInQueues.)
Nov 30 03:13:53.000 [notice] Removed 528 bytes by killing 1 circuits; 0 circuits remain alive. Also killed 0 non-linked directory connections.
Nov 30 03:13:53.000 [notice] We're low on memory. Killing circuits with over-long queues. (This behavior is controlled by MaxMemInQueues.)
Nov 30 03:13:53.000 [notice] Removed 528 bytes by killing 2 circuits; 0 circuits remain alive. Also killed 0 non-linked directory connections.
Nov 30 03:13:54.000 [notice] We're low on memory. Killing circuits with over-long queues. (This behavior is controlled by MaxMemInQueues.)
Nov 30 03:13:54.000 [notice] Removed 528 bytes by killing 1 circuits; 0 circuits remain alive. Also killed 0 non-linked directory connections.
Nov 30 03:13:54.000 [notice] We're low on memory. Killing circuits with over-long queues. (This behavior is controlled by MaxMemInQueues.)
Nov 30 03:13:54.000 [notice] Removed 528 bytes by killing 2 circuits; 0 circuits remain alive. Also killed 0 non-linked directory connections.
I notice in cell_queues_check_size() that we sum up four things to compute alloc:
size_t alloc = cell_queues_get_total_allocation();
alloc += buf_get_total_allocation();
alloc += tor_compress_get_total_allocation();
const size_t rend_cache_total = rend_cache_get_total_allocation();
alloc += rend_cache_total;
For operators who are debugging their memory use, and for us poor people trying to help diagnose, it would seem smart for us to expose these four numbers when we say "We're low on memory".
(I thought about this idea in particular because of the tor_compress_get_total_allocation() call and legacy/trac#24368 (moved).)