[tor-bugs] #15435 [Tor]: Tor should not close stdin on child processes.

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Mar 26 13:56:39 UTC 2015


#15435: Tor should not close stdin on child processes.
---------------------------+-----------------------------------------------
     Reporter:  yawning    |      Owner:
         Type:             |     Status:  needs_review
  enhancement              |  Milestone:  Tor: 0.2.7.x-final
     Priority:  normal     |    Version:  Tor: unspecified
    Component:  Tor        |   Keywords:  tor-pt, needs-spec-patch pt-wants
   Resolution:             |  Parent ID:
Actual Points:             |
       Points:             |
---------------------------+-----------------------------------------------
Description changed by yawning:

Old description:

> The lack of PTs having a reliable way to detect if tor is dead reared
> it's ugly head again in the form of #15434.  There aren't that many good
> ways to detect if a parent has died, beyond checking if stdin is still
> open (Proposed in #10047), but tor explicitly closes the child process's
> stdin.
>
> Since a variant of this has been working well, I propose that we make it
> official like thus:
>  * Add a new enviornment variable of the form `PT_EXIT_ON_STDIN_CLOSE=1`,
> indicating that Tor will not close the stdin.
>  * PTs SHOULD terminate as if they have received a SIGTERM, on stdin
> being closed if the environment variable is set.
>  * All new tor versions will naturally set said env. var, and setup the
> pt plugin stdin correctly.
>
> This does mean that Bridges will consume one extra file descriptor per
> `ServerTransportPlugin` line in the torrc, but I view this as acceptable
> given the fact that this will bring some much needed sanity to our
> cleanup process.

New description:

 The lack of PTs having a reliable way to detect if tor is dead reared it's
 ugly head again in the form of #15434.  There aren't that many good ways
 to detect if a parent has died, beyond checking if stdin is still open
 (#10047 says stdout, however stdin is better), but tor explicitly closes
 the child process's stdin.

 Since a variant of this has been working well, I propose that we make it
 official like thus:
  * Add a new enviornment variable of the form
 `TOR_PT_EXIT_ON_STDIN_CLOSE=1`, indicating that Tor will not close the
 stdin.
  * PTs SHOULD terminate as if they have received a SIGTERM, on stdin being
 closed if the environment variable is set.
  * All new tor versions will naturally set said env. var, and setup the pt
 plugin stdin correctly.

 This does mean that Bridges will consume one extra file descriptor per
 `ServerTransportPlugin` line in the torrc, but I view this as acceptable
 given the fact that this will bring some much needed sanity to our cleanup
 process.

--

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


More information about the tor-bugs mailing list