Opened 2 years ago

Closed 13 months ago

#25493 closed enhancement (implemented)

Improve patterns for cleaning up static variables on exit/restart

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


In his review for #23524, asn says:

I feel like resetting all the global statics on tor_free_all() makes sense but it's all a very brittle logic. The moment someone adds a new global static in that file and doesn't know about this convention of wiping at tor_free_all(), it will introduce a bug IIUC. Furthermore, the fact that some of those vars get reset to 0 and others to 1 is kinda arbitrary (and you need to look at their definitions to see if it's correct).

I wonder what we could do about 3809036 to make it better. Perhaps we should de-global those variables, put them in a struct, and initialize them in a function, then call that function from some entry-point and tor_free_all()? That seems like a better approach but probably not so trivial. Maybe subject for a future ticket on this area?

We should indeed look for better patterns to solve this issue, since the current approach is indeed fragile.

Child Tickets

Change History (13)

comment:1 Changed 2 years ago by nickm

Keywords: 034-triage-20180328 added

comment:2 Changed 2 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 2 years ago by nickm

Keywords: 034-roadmap-subtask 034-included-20180405 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

These are still worth doing, but I don't see them as likely to happen before our freeze in 4 days, and nobody is currently assigned to them. Deferring them to 0.3.5

comment:5 Changed 2 years ago by nickm

Keywords: 035-roadmap-subtask added

comment:6 Changed 2 years ago by nickm

Keywords: 035-triaged-in-20180711 added

comment:7 Changed 23 months ago by dgoulet

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

Related to our mobile API work. We are pass the 035 freeze, sending to 036.

comment:8 Changed 21 months 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:9 Changed 19 months ago by gaba

Sponsor: Sponsor8

comment:10 Changed 19 months ago by nickm

Sponsor: Sponsor31-can

comment:11 Changed 19 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 13 months ago by nickm

I believe that this is in progress, via our "subsystems" design.

comment:13 Changed 13 months ago by nickm

Resolution: implemented
Status: newclosed
Note: See TracTickets for help on using tickets.