[tor-bugs] #33411 [Core Tor/Tor]: Make DirCache default to 0 on Windows relays

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Mar 5 16:37:19 UTC 2020


#33411: Make DirCache default to 0 on Windows relays
-------------------------------------------------+-------------------------
 Reporter:  teor                                 |          Owner:  (none)
     Type:  defect                               |         Status:  new
 Priority:  Medium                               |      Milestone:  Tor:
                                                 |  0.4.4.x-final
Component:  Core Tor/Tor                         |        Version:  Tor:
                                                 |  0.3.1.9
 Severity:  Normal                               |     Resolution:
 Keywords:  044-should, cpu, windows, linux,     |  Actual Points:
  performance, regression, 033-triage-20180326,  |
  033-removed-20180326, 034-deferred-20180602,   |
  035-removed-20180711, 032-unreached-backport,  |
  040-roadmap-proposed, 033-unreached-backport-  |
  maybe, network-health                          |
Parent ID:  #24857                               |         Points:  0.2
 Reviewer:                                       |        Sponsor:
-------------------------------------------------+-------------------------

Comment (by gvanem):

 Having a `DirCache 0` can still cause >= 90% CPU for me.
 But looking at the call-stacks of these CPU-hog threads, I noticed
 `tor_cond_wait()` was a candidate.

 So just adding a `SleepEx()` in that function, I no longer see any such
 high CPU usage
 (I think after only 5 hours of run-time). Here's my patch:
 {{{
 --- a/lib/thread/compat_winthreads.c 2020-01-24 21:59:07
 +++ b/lib/thread/compat_winthreads.c 2020-03-05 14:11:58
 @@ -170,6 +170,8 @@
    do {
      DWORD res;
      res = WaitForSingleObject(cond->event, ms);
 +
 +    SleepEx(1, TRUE);
      EnterCriticalSection(&cond->lock);
      if (cond->n_to_wake &&
          cond->generation != generation_at_start) {
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/33411#comment:1>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list