Opened 15 months ago

Last modified 4 months ago

#25493 new enhancement

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

Description

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 (11)

comment:1 Changed 14 months ago by nickm

Keywords: 034-triage-20180328 added

comment:2 Changed 14 months ago by nickm

Keywords: 034-removed-20180328 added

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

comment:3 Changed 14 months ago by nickm

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

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

Keywords: 035-roadmap-subtask added

comment:6 Changed 11 months ago by nickm

Keywords: 035-triaged-in-20180711 added

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

Sponsor: Sponsor8

comment:10 Changed 4 months ago by nickm

Sponsor: Sponsor31-can

comment:11 Changed 4 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.

Note: See TracTickets for help on using tickets.