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

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Aug 27 04:49:38 UTC 2018


#24857: tor 0.3.1.9 100% cpu load
-------------------------------------------------+-------------------------
 Reporter:  Eugene646                            |          Owner:  (none)
     Type:  defect                               |         Status:
                                                 |  assigned
 Priority:  Medium                               |      Milestone:  Tor:
                                                 |  unspecified
Component:  Core Tor/Tor                         |        Version:  Tor:
                                                 |  0.3.1.9
 Severity:  Normal                               |     Resolution:
 Keywords:  cpu, windows, linux, performance,    |  Actual Points:
  regression, 033-triage-20180326,               |
  033-removed-20180326, 034-deferred-20180602,   |
  035-removed-20180711, 032-backport-maybe, 033  |
  -backport-maybe, 034-backport                  |
Parent ID:  #25500                               |         Points:
 Reviewer:                                       |        Sponsor:
-------------------------------------------------+-------------------------

Comment (by mestriga):

 Replying to [comment:34 teor]:

 > Replying to [comment:33 mestriga]:
 > > The conditional code for Windows (#define MUST_UNMAP_TO_UNLINK) made
 the code harder to read, and a cleaner solution is possible (with the
 files still mapped, marking them for deletion on close, while possibly
 moving them to another directory).
 > Do you have a patch you would like to suggest?

 I don't know how to build Tor, but I will leave here the Windows code
 that, unlike !DeleteFile, is able to remove a file that it is memory
 mapped, making the "#define MUST_UNMAP_TO_UNLINK" workaround unnecessary.
 I tested this code against a file memory mapped with the exact same
 parameters that Tor uses and confirmed that it works.

 1. Open a handle for exclusive access to the file with the
 FILE_FLAG_DELETE_ON_CLOSE flag:

 {{{
 file_handle = fileCreateFile(
     tfilename,
     0,
     NULL,
     OPEN_ALWAYS,
     FILE_FLAG_DELETE_ON_CLOSE,
     0);
 }}}
 2. Check that the handle is valid, fail if it is not (due to a sharing
 violation or if the file does not exist):

 {{{
 if (file_handle == INVALID_HANDLE_VALUE)
    goto win_err;
 }}}
 3. Close the handle:

 {{{
 CloseHandle(file_handle);
 }}}
 4. Whether memory mapped or not, the file is gone!

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


More information about the tor-bugs mailing list