[tor-bugs] #24857 [Core Tor/Tor]: tor 0.3.1.9 100% cpu load

Tor Bug Tracker & Wiki blackhole at torproject.org
Sun Mar 25 12:33:06 UTC 2018


#24857: tor 0.3.1.9 100% cpu load
-------------------------------------------------+-------------------------
 Reporter:  Eugene646                            |          Owner:  (none)
     Type:  defect                               |         Status:  new
 Priority:  Medium                               |      Milestone:  Tor:
                                                 |  0.3.3.x-final
Component:  Core Tor/Tor                         |        Version:  Tor:
                                                 |  0.3.1.9
 Severity:  Normal                               |     Resolution:
 Keywords:  cpu, windows, linux, performance,    |  Actual Points:
  regression                                     |
Parent ID:                                       |         Points:
 Reviewer:                                       |        Sponsor:
-------------------------------------------------+-------------------------

Comment (by cypherpunks):

 > it looks like a dumb mingw implementation of some function

 {{{
 #ifdef _WIN32
 /* On Windows, unlink won't work on a file if the file is actively
 mmap()ed.
  * That forces us to be less aggressive about unlinking files, and causes
 other
  * changes throughout our logic.
  */
 #define MUST_UNMAP_TO_UNLINK
 #endif /* defined(_WIN32) */
 }}}
 {{{
 #ifdef MUST_UNMAP_TO_UNLINK
   /* If we can't unlink the files that we're still using, then we need to
    * tell the storagedir backend to allow far more files than this
 consensus
    * cache actually wants, so that it can hold files which, from this
 cache's
    * perspective, have become useless.
    */
 #define VERY_LARGE_STORAGEDIR_LIMIT (1000*1000)
   storagedir_max_entries = VERY_LARGE_STORAGEDIR_LIMIT;
 #else /* !(defined(MUST_UNMAP_TO_UNLINK)) */
   /* Otherwise, we can just tell the storagedir to use the same limits
    * as this cache. */
   storagedir_max_entries = max_entries;
 #endif /* defined(MUST_UNMAP_TO_UNLINK) */
 }}}
 {{{
 get_max_age_to_cache(void)
 {
   const int32_t DEFAULT_MAX_AGE_TO_CACHE = 8192;
   const int32_t MIN_MAX_AGE_TO_CACHE = 0;
   const int32_t MAX_MAX_AGE_TO_CACHE = 8192;
   const char MAX_AGE_TO_CACHE_NAME[] = "max-consensus-age-to-cache-for-
 diff";

   const or_options_t *options = get_options();

   if (options->MaxConsensusAgeForDiffs) {
     const int v = options->MaxConsensusAgeForDiffs;
     if (v >= MAX_MAX_AGE_TO_CACHE * 3600)
       return MAX_MAX_AGE_TO_CACHE;
     else
       return v;
   }

   /* The parameter is in hours, so we multiply */
   return 3600 * networkstatus_get_param(NULL,
                                         MAX_AGE_TO_CACHE_NAME,
                                         DEFAULT_MAX_AGE_TO_CACHE,
                                         MIN_MAX_AGE_TO_CACHE,
                                         MAX_MAX_AGE_TO_CACHE);
 }
 }}}

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


More information about the tor-bugs mailing list