[tor-bugs] #28179 [Core Tor/Tor]: Handle output from PT processes with the event loop

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Nov 27 21:21:11 UTC 2018


#28179: Handle output from PT processes with the event loop
-----------------------------------------+---------------------------------
 Reporter:  ahf                          |          Owner:  ahf
     Type:  enhancement                  |         Status:  needs_review
 Priority:  Medium                       |      Milestone:  Tor:
                                         |  0.4.0.x-final
Component:  Core Tor/Tor                 |        Version:  Tor:
                                         |  unspecified
 Severity:  Normal                       |     Resolution:
 Keywords:  tor-pt, 040-roadmap-subtask  |  Actual Points:
Parent ID:  #25502                       |         Points:
 Reviewer:  dgoulet                      |        Sponsor:  Sponsor8
-----------------------------------------+---------------------------------

Comment (by dcf):

 This program may be useful for testing: attachment:bug28179-client.go

 It's a modified version of dummy-client from goptlib. The differences are
 that after PT initialization, it starts writing to stdout and stderr at 4
 KB/s. Also, in its core proxying loop, it tries to write a line to
 stdout/stderr every time it downloads a chunk of data. Eventually the
 stdout and stderr buffers fill up, and the proxy loop halts because it
 cannot write its line. The program copies everything it writes to
 stdout/stderr to a file called mirror.log, so you can see how much was
 written before it deadlocks.

 1. Download and put in a directory called bug28179-client.
 2. `go get` and `go build`.
 3. Put in torrc:\\
 {{{
 DataDirectory datadir
 UseBridges 1
 ClientTransportPlugin dummy exec bug28179-client
 Bridge dummy 128.31.0.61:443
 }}}
 4. `tor -f torrc SOCKSPort 10000`
 5. In another terminal, `tail -F mirror.log`. You will see a mixture of
 `hello tor world` and `received XXX bytes` lines.
 6. For me, the system deadlocks after 8 seconds; apparently the
 stdout/stderr buffers are 64 KB.\\
    {{{
 $ ls -l mirror.log
 -rw-r--r-- 1 david david 65425 Nov 27 14:09 mirror.log
    }}}
    If tor was in the middle of bootstrapping, it will stop here. If tor
 finished bootstrapping, you can verify that it stopped working with `curl
 -x socks5h://127.0.0.1:10000/ https://example.com/`.

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


More information about the tor-bugs mailing list