Opened 3 years ago

Last modified 8 months ago

#25607 new defect

On restart-in-process, do the right thing with thread-local storage

Reported by: nickm Owned by:
Priority: Medium Milestone: Tor: unspecified
Component: Core Tor/Tor Version:
Severity: Normal Keywords: 034-triage-20180328, 034-included-20180405, 034-roadmap-subticket, 035-roadmap-subtask, 035-triaged-in-20180711, 040-deferred-201915
Cc: Actual Points:
Parent ID: #25510 Points:
Reviewer: Sponsor:

Description

We use thread-local storage in one or two places; we should make sure that when tor shuts down, it's dropped, and when tor starts up again in the same process, it's created as an independent key.

Child Tickets

Change History (13)

comment:1 Changed 3 years ago by nickm

Keywords: 034-triage-20180328 added

comment:2 Changed 3 years ago by nickm

Keywords: 034-removed-20180328 added

Per our triage process, these tickets are pending removal from 0.3.4.

comment:3 Changed 3 years ago by nickm

Keywords: 034-included-20180405 034-roadmap-subticket added; 034-removed-20180328 removed
Parent ID: #25510

comment:4 Changed 2 years ago by nickm

Milestone: Tor: 0.3.4.x-finalTor: 0.3.5.x-final

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.

comment:5 Changed 2 years ago by nickm

(This is a must-do, since this bug represents a slow resource leak on embedded Tors)

comment:6 Changed 2 years ago by nickm

Keywords: 035-roadmap-subtask added

comment:7 Changed 2 years ago by nickm

Keywords: 035-triaged-in-20180711 added

comment:8 Changed 2 years ago by nickm

Milestone: Tor: 0.3.5.x-finalTor: 0.3.6.x-final

These are not on track for 0.3.5, given the amount of time remaining before freeze.

comment:9 Changed 2 years ago by nickm

Milestone: Tor: 0.3.6.x-finalTor: 0.4.0.x-final

Tor 0.3.6.x has been renamed to 0.4.0.x.

comment:10 Changed 22 months ago by gaba

Keywords: s8-api removed
Sponsor: Sponsor8

comment:11 Changed 22 months ago by nickm

Keywords: 040-deferred-201915 added
Milestone: Tor: 0.4.0.x-finalTor: unspecified

Deferring some tickets from 0.4.0 without proposing them for later. Please tag with 041-proposed if you want to do them.

comment:12 Changed 16 months ago by nickm

Owner: nickm deleted

These tickets are not things I'm currently working on. They may be important, but they don't need to be done by me specifically. Un-assigning.

comment:13 Changed 8 months ago by teor

Status: assignednew

Change tickets that are assigned to nobody to "new".

Note: See TracTickets for help on using tickets.