Recent regression during sighup with owned process
Hi Nick. After much head scratching I've come up with a repro for the recent burst of stem integ test failures we got after your big push on 9/13. The issue seems to manifest when tor is started with OwningControllerProcess then given a sighup...
atagar@odin:~/Desktop/tor/tor$ cat torrc
DataDirectory /tmp/my_data
atagar@odin:~/Desktop/tor/tor$ cat demo.sh
tor -f torrc __OwningControllerProcess $$ &
sleep 10
pkill -sighup tor
sleep 60
atagar@odin:~/Desktop/tor/tor$ ./demo.sh
Sep 14 14:53:03.180 [notice] Tor v0.2.5.0-alpha-dev (git-147a0f31bd72cfd2) running on Linux with Libevent 2.0.16-stable, OpenSSL 1.0.1 and Zlib 1.2.3.4.
Sep 14 14:53:03.180 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
Sep 14 14:53:03.180 [notice] This version is not a stable Tor release. Expect more bugs than usual.
Sep 14 14:53:03.180 [notice] Read configuration file "/home/atagar/Desktop/tor/tor/torrc".
Sep 14 14:53:03.184 [notice] Opening Socks listener on 127.0.0.1:9050
Sep 14 14:53:03.000 [notice] We now have enough directory information to build circuits.
Sep 14 14:53:03.000 [notice] Bootstrapped 80%: Connecting to the Tor network.
Sep 14 14:53:04.000 [notice] Bootstrapped 85%: Finishing handshake with first hop.
Sep 14 14:53:05.000 [notice] Bootstrapped 90%: Establishing a Tor circuit.
Sep 14 14:53:06.000 [notice] Tor has successfully opened a circuit. Looks like client functionality is working.
Sep 14 14:53:06.000 [notice] Bootstrapped 100%: Done.
Sep 14 14:53:13.000 [notice] Received reload signal (hup). Reloading config and resetting internal state.
Sep 14 14:53:13.000 [notice] Configuration file "/usr/local/etc/tor/torrc" not present, using reasonable defaults.
Sep 14 14:53:13.000 [warn] Failed to parse/validate config: While Tor is running, changing DataDirectory ("/tmp/my_data"->"/home/atagar/.tor") is not allowed.
Sep 14 14:53:13.000 [err] Reading config failed--see warnings above. For usage, try -h.
Sep 14 14:53:13.000 [warn] Restart failed (config error?). Exiting.
The issue looks to be that the HUP changes the torrc it loads from the argument provided via -f (./torrc) to its default (/usr/local/etc/tor/torrc).
Cheers! -Damian