Opened 5 years ago

Last modified 2 years ago

#12572 new enhancement

Proposal for __OwningControllerTimeout option

Reported by: yarong Owned by:
Priority: Medium Milestone: Tor: unspecified
Component: Core Tor/Tor Version:
Severity: Normal Keywords: tor-client needs-design lorax
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


TL;DR - Can we add __OwningControllerTimeout option that will cause the Tor OP to exit if it doesn't receive a TAKEOWNERSHIP in the specified time interval?

#3049 added TAKEOWNERSHIP and __OwningControllerProcess to handle situations where a parent wants to spawn the Tor OP as a child and connect their life spans.

The problem is that __OwningControllerProcess is very platform specific. It assumes that the Tor OP can see the parent PID and detect if it goes away. But this works differently on every platform and every new version of every platform. Then one gets to do fun things like add it to Android. It's a recipe for a lot of testing and compatibility issues.

__OwningControllerProcess also doesn't handle situations where the parent might itself become a zombie so its PID is still there but it's not really running.

A potentially simpler solution that doesn't have cross platform issues is to introduce the __OwningControllerTimeout option. This would specify that if the Tor OP doesn't receive a TAKEOWNERSHIP command within a certain time period then the Tor OP should exit automatically.

There is still a potential race condition here if the parent somehow gets blocked but this is easily detectable and recoverable by the parent.

For bonus points we could also add keep alives to TAKEOWNERSHIP in case the parent becomes a zombie but this is probably getting a big excessive.

Child Tickets

Change History (7)

comment:1 Changed 5 years ago by yarong

Also note that this is also great for clients since it means they don't have to write (and test) platform specific code to handle finding their parent PID.

comment:2 Changed 5 years ago by nickm

Milestone: Tor: 0.2.???

An interesting idea! Controller writers who use TakeOwnership: would you use this?

comment:3 Changed 5 years ago by atagar

I don't have need for it at present, but happy to add the capability to stem if/when it's added to tor.

comment:4 Changed 3 years ago by teor

Milestone: Tor: 0.2.???Tor: 0.3.???

Milestone renamed

comment:5 Changed 3 years ago by nickm

Keywords: tor-03-unspecified-201612 added
Milestone: Tor: 0.3.???Tor: unspecified

Finally admitting that 0.3.??? was a euphemism for Tor: unspecified all along.

comment:6 Changed 2 years ago by nickm

Keywords: tor-03-unspecified-201612 removed

Remove an old triaging keyword.

comment:7 Changed 2 years ago by nickm

Keywords: needs-design lorax added
Severity: Normal
Note: See TracTickets for help on using tickets.