Currently the output from stdout/stderr of a PT process is only read during the startup of the process. The reading process uses read() on a non-blocking socket, which currently seems to work, but have proved to be flaky.
We should ensure that PT processes' output can be read all the time.
On Windows we cannot attach the pipes to the main loop because of limitations of the select() API, so we have to do something slightly worse such as reading from the stdout/stderr handle via a timer as long as the processes are alive.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items ...
Show closed items
Linked items 0
Link issues together to show that they're related.
Learn more.
Related to this is #26360 (moved). tor should read from transport plugins' stderr, if only to prevent processes from deadlocking when they write to it too much.
Did a pass on it. No show stopper for now but what I would need also is some documentation on how that API is used since right now it is very "abstract" to the process.c and not used outside of it. One thing that could be done there is to do some documentation on how to use the API at the start of process.c?
/* The format is 'LOG <transport> <message>'. We accept empty messages. */
It looks like this comment is out of date; I thought the <transport> part was removed. Also "We accept empty messages" seems to contradict the "Managed proxy sent us a LOG line with missing arguments" check above: I suppose that LOG (with a space) is acceptable but LOG is not, not sure if that's what's intended.
/** A pluggable transport called <b>transport_name</b> has emitted a log * message found in <b>message</b>. */voidcontrol_event_transport_log(const char *transport_name, const char *message){ send_control_event(EVENT_TRANSPORT_LOG, "650 TRANSPORT_LOG %s %s\r\n", transport_name, message);}
Where does <transport_name> come from? Is it the path the executable? In general, tor won't know a specific transport name corresponding to any LOG message. I don't see where control_event_transport_log is called other than in tests.
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.
Download and put in a directory called bug28179-client.
In another terminal, tail -F mirror.log. You will see a mixture of hello tor world and received XXX bytes lines.
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/.