[tor-bugs] #25607 [Core Tor/Tor]: On restart-in-process, do the right thing with thread-local storage

Tor Bug Tracker & Wiki blackhole at torproject.org
Fri May 18 19:41:57 UTC 2018


#25607: On restart-in-process, do the right thing with thread-local storage
-------------------------------------------------+-------------------------
 Reporter:  nickm                                |          Owner:  nickm
     Type:  defect                               |         Status:
                                                 |  assigned
 Priority:  Medium                               |      Milestone:  Tor:
                                                 |  0.3.5.x-final
Component:  Core Tor/Tor                         |        Version:
 Severity:  Normal                               |     Resolution:
 Keywords:  s8-api, 034-triage-20180328,         |  Actual Points:
  034-included-20180405 034-roadmap-subticket    |
Parent ID:  #25510                               |         Points:
 Reviewer:                                       |        Sponsor:
                                                 |  Sponsor8
-------------------------------------------------+-------------------------
Changes (by nickm):

 * milestone:  Tor: 0.3.4.x-final => Tor: 0.3.5.x-final


Comment:

 This is looking to be a larger issue than I want to do post-freeze.

 Briefly: we can't clean up the thread-local storage until all the worker
 threads are done, and the main thread doesn't currently check whether the
 worker threads are done.

 We need to add the following generic mechanisms to compat_*threads:
   - A way to register a resource to get cleaned up on thread exit.
   - Some way to make sure thread-local pointers get freed on thread exit,
 on windows.  (For pthreads, we can use the native mechanism)
   - A way to check whether a thread is completed
   - A way to join a thread

 We need to use the above mechanisms in workqueue.c

 We need to shut down the workqueue on exiting the main thread.

 Once all the workqueue threads are shut down, we can delete the thread-
 local storage.

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


More information about the tor-bugs mailing list