aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2021-01-21 13:40:46 -0500
committerNick Mathewson <nickm@torproject.org>2021-01-21 13:40:46 -0500
commit497ff1e193a0ddfc36ee86edb6c90354e6eec43d (patch)
treed86b8c01371e6eb47ebe54d334ca3f3850c4cef6
parent397fc7a1682a8d3a57998fa95aba60ad3d87fd15 (diff)
parent08c0ef61d8aa9490f78c3a77c1fbb86de09b1872 (diff)
downloadtor-497ff1e193a0ddfc36ee86edb6c90354e6eec43d.tar.gz
tor-497ff1e193a0ddfc36ee86edb6c90354e6eec43d.zip
Merge branch 'maint-0.4.5' into release-0.4.5
-rw-r--r--changes/bug248576
-rw-r--r--src/feature/dircache/consdiffmgr.c12
2 files changed, 17 insertions, 1 deletions
diff --git a/changes/bug24857 b/changes/bug24857
new file mode 100644
index 0000000000..ea9c763332
--- /dev/null
+++ b/changes/bug24857
@@ -0,0 +1,6 @@
+ o Minor bugfixes (directory cache, performance, windows):
+ - Limit the number of items in the consensus diff cache to 64 on Windows.
+ We hope this will resolve an issue where Windows relay operators reported
+ Tor using 100% CPU while we investigate better solutions. Fixes bug 24857;
+ bugfix on 0.3.1.1-alpha.
+
diff --git a/src/feature/dircache/consdiffmgr.c b/src/feature/dircache/consdiffmgr.c
index 10590cd6d2..21f536432c 100644
--- a/src/feature/dircache/consdiffmgr.c
+++ b/src/feature/dircache/consdiffmgr.c
@@ -177,6 +177,16 @@ typedef struct cdm_diff_t {
/** Hashtable mapping flavor and source consensus digest to status. */
static HT_HEAD(cdm_diff_ht, cdm_diff_t) cdm_diff_ht = HT_INITIALIZER();
+#ifdef _WIN32
+ // XXX(ahf): For tor#24857, a contributor suggested that on Windows, the CPU
+ // begins to spike at 100% once the number of files handled by the consensus
+ // diff manager becomes larger than 64. To see if the issue goes away, we
+ // hardcode this value to 64 now while we investigate a better solution.
+# define CACHE_MAX_NUM 64
+#else
+# define CACHE_MAX_NUM 128
+#endif
+
/**
* Configuration for this module
*/
@@ -184,7 +194,7 @@ static consdiff_cfg_t consdiff_cfg = {
// XXXX I'd like to make this number bigger, but it interferes with the
// XXXX seccomp2 syscall filter, which tops out at BPF_MAXINS (4096)
// XXXX rules.
- /* .cache_max_num = */ 128
+ /* .cache_max_num = */ CACHE_MAX_NUM
};
static int consdiffmgr_ensure_space_for_files(int n);