mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-20 02:09:24 +01:00
Rename MaxMemInCellQueues to MaxMemInQueues
This commit is contained in:
parent
03ff21b018
commit
e572ec856d
@ -1475,13 +1475,13 @@ is non-zero):
|
|||||||
localhost, RFC1918 addresses, and so on. This can create security issues;
|
localhost, RFC1918 addresses, and so on. This can create security issues;
|
||||||
you should probably leave it off. (Default: 0)
|
you should probably leave it off. (Default: 0)
|
||||||
|
|
||||||
**MaxMemInCellQueues** __N__ **bytes**|**KB**|**MB**|**GB**::
|
**MaxMemInQueues** __N__ **bytes**|**KB**|**MB**|**GB**::
|
||||||
This option configures a threshold above which Tor will assume that it
|
This option configures a threshold above which Tor will assume that it
|
||||||
needs to stop queueing cells because it's about to run out of memory.
|
needs to stop queueing or buffering data because it's about to run out of
|
||||||
If it hits this threshold, it will begin killing circuits until it
|
memory. If it hits this threshold, it will begin killing circuits until
|
||||||
has recovered at least 10% of this memory. Do not set this option too
|
it has recovered at least 10% of this memory. Do not set this option too
|
||||||
low, or your relay may be unreliable under load. This option only
|
low, or your relay may be unreliable under load. This option only
|
||||||
effects circuit queues, so the actual process size will be larger than
|
affects some queues, so the actual process size will be larger than
|
||||||
this. (Default: 8GB)
|
this. (Default: 8GB)
|
||||||
|
|
||||||
DIRECTORY SERVER OPTIONS
|
DIRECTORY SERVER OPTIONS
|
||||||
|
@ -1512,11 +1512,11 @@ circuits_compare_by_oldest_queued_item_(const void **a_, const void **b_)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FRACTION_OF_CELLS_TO_RETAIN_ON_OOM 0.90
|
#define FRACTION_OF_DATA_TO_RETAIN_ON_OOM 0.90
|
||||||
|
|
||||||
/** We're out of memory for cells, having allocated <b>current_allocation</b>
|
/** We're out of memory for cells, having allocated <b>current_allocation</b>
|
||||||
* bytes' worth. Kill the 'worst' circuits until we're under
|
* bytes' worth. Kill the 'worst' circuits until we're under
|
||||||
* FRACTION_OF_CIRCS_TO_RETAIN_ON_OOM of our maximum usage. */
|
* FRACTION_OF_DATA_TO_RETAIN_ON_OOM of our maximum usage. */
|
||||||
void
|
void
|
||||||
circuits_handle_oom(size_t current_allocation)
|
circuits_handle_oom(size_t current_allocation)
|
||||||
{
|
{
|
||||||
@ -1530,11 +1530,11 @@ circuits_handle_oom(size_t current_allocation)
|
|||||||
uint32_t now_ms;
|
uint32_t now_ms;
|
||||||
log_notice(LD_GENERAL, "We're low on memory. Killing circuits with "
|
log_notice(LD_GENERAL, "We're low on memory. Killing circuits with "
|
||||||
"over-long queues. (This behavior is controlled by "
|
"over-long queues. (This behavior is controlled by "
|
||||||
"MaxMemInCellQueues.)");
|
"MaxMemInQueues.)");
|
||||||
|
|
||||||
{
|
{
|
||||||
size_t mem_target = (size_t)(get_options()->MaxMemInCellQueues *
|
size_t mem_target = (size_t)(get_options()->MaxMemInQueues *
|
||||||
FRACTION_OF_CELLS_TO_RETAIN_ON_OOM);
|
FRACTION_OF_DATA_TO_RETAIN_ON_OOM);
|
||||||
if (current_allocation <= mem_target)
|
if (current_allocation <= mem_target)
|
||||||
return;
|
return;
|
||||||
mem_to_recover = current_allocation - mem_target;
|
mem_to_recover = current_allocation - mem_target;
|
||||||
|
@ -115,6 +115,7 @@ static config_abbrev_t _option_abbrevs[] = {
|
|||||||
{ "BandwidthBurstBytes", "BandwidthBurst", 0, 0},
|
{ "BandwidthBurstBytes", "BandwidthBurst", 0, 0},
|
||||||
{ "DirFetchPostPeriod", "StatusFetchPeriod", 0, 0},
|
{ "DirFetchPostPeriod", "StatusFetchPeriod", 0, 0},
|
||||||
{ "MaxConn", "ConnLimit", 0, 1},
|
{ "MaxConn", "ConnLimit", 0, 1},
|
||||||
|
{ "MaxMemInCellQueues", "MaxMemInQueues", 0, 0},
|
||||||
{ "ORBindAddress", "ORListenAddress", 0, 0},
|
{ "ORBindAddress", "ORListenAddress", 0, 0},
|
||||||
{ "DirBindAddress", "DirListenAddress", 0, 0},
|
{ "DirBindAddress", "DirListenAddress", 0, 0},
|
||||||
{ "SocksBindAddress", "SocksListenAddress", 0, 0},
|
{ "SocksBindAddress", "SocksListenAddress", 0, 0},
|
||||||
@ -343,7 +344,7 @@ static config_var_t _option_vars[] = {
|
|||||||
V(MaxAdvertisedBandwidth, MEMUNIT, "1 GB"),
|
V(MaxAdvertisedBandwidth, MEMUNIT, "1 GB"),
|
||||||
V(MaxCircuitDirtiness, INTERVAL, "10 minutes"),
|
V(MaxCircuitDirtiness, INTERVAL, "10 minutes"),
|
||||||
V(MaxClientCircuitsPending, UINT, "32"),
|
V(MaxClientCircuitsPending, UINT, "32"),
|
||||||
V(MaxMemInCellQueues, MEMUNIT, "8 GB"),
|
V(MaxMemInQueues, MEMUNIT, "8 GB"),
|
||||||
V(MaxOnionsPending, UINT, "100"),
|
V(MaxOnionsPending, UINT, "100"),
|
||||||
OBSOLETE("MonthlyAccountingStart"),
|
OBSOLETE("MonthlyAccountingStart"),
|
||||||
V(MyFamily, STRING, NULL),
|
V(MyFamily, STRING, NULL),
|
||||||
@ -3669,10 +3670,10 @@ options_validate(or_options_t *old_options, or_options_t *options,
|
|||||||
log_warn(LD_CONFIG, "EntryNodes is set, but UseEntryGuards is disabled. "
|
log_warn(LD_CONFIG, "EntryNodes is set, but UseEntryGuards is disabled. "
|
||||||
"EntryNodes will be ignored.");
|
"EntryNodes will be ignored.");
|
||||||
|
|
||||||
if (options->MaxMemInCellQueues < (500 << 20)) {
|
if (options->MaxMemInQueues < (500 << 20)) {
|
||||||
log_warn(LD_CONFIG, "MaxMemInCellQueues must be at least 500 MB for now. "
|
log_warn(LD_CONFIG, "MaxMemInQueues must be at least 500 MB for now. "
|
||||||
"Ideally, have it as large as you can afford.");
|
"Ideally, have it as large as you can afford.");
|
||||||
options->MaxMemInCellQueues = (500 << 20);
|
options->MaxMemInQueues = (500 << 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
options->_AllowInvalid = 0;
|
options->_AllowInvalid = 0;
|
||||||
|
@ -3075,9 +3075,8 @@ typedef struct {
|
|||||||
config_line_t *DirPort_lines;
|
config_line_t *DirPort_lines;
|
||||||
config_line_t *DNSPort_lines; /**< Ports to listen on for DNS requests. */
|
config_line_t *DNSPort_lines; /**< Ports to listen on for DNS requests. */
|
||||||
|
|
||||||
uint64_t MaxMemInCellQueues; /**< If we have more memory than this allocated
|
uint64_t MaxMemInQueues; /**< If we have more memory than this allocated
|
||||||
* for circuit cell queues, run the OOM handler
|
* for queues and buffers, run the OOM handler */
|
||||||
*/
|
|
||||||
|
|
||||||
/** @name port booleans
|
/** @name port booleans
|
||||||
*
|
*
|
||||||
|
@ -1999,7 +1999,7 @@ cell_queues_check_size(void)
|
|||||||
{
|
{
|
||||||
size_t alloc = total_cells_allocated * packed_cell_mem_cost();
|
size_t alloc = total_cells_allocated * packed_cell_mem_cost();
|
||||||
alloc += buf_get_total_allocation();
|
alloc += buf_get_total_allocation();
|
||||||
if (alloc >= get_options()->MaxMemInCellQueues) {
|
if (alloc >= get_options()->MaxMemInQueues) {
|
||||||
circuits_handle_oom(alloc);
|
circuits_handle_oom(alloc);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user