Conflicting ports cause tor to crash
Hi Nick, here's the bug I've been nagging about on irc the last few days. :P
Recent regression is causing stem's integ tests to fail. This should be easily reproducible with tor's stem integ target (maybe we could run that prior to pushes?).
Here's a standalone repro...
atagar@morrigan:~/Desktop/stem$ cat ~/bad_torrc
SocksPort 1234
ControlPort 1234
atagar@morrigan:~/Desktop/stem$ tor -f ~/bad_torrc
Apr 30 11:43:32.107 [notice] Tor 0.3.4.0-alpha-dev (git-d1a0534649be02e3) running on Linux with Libevent 2.0.21-stable, OpenSSL 1.0.2g, Zlib 1.2.8, Liblzma N/A, and Libzstd N/A.
Apr 30 11:43:32.107 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
Apr 30 11:43:32.107 [notice] This version is not a stable Tor release. Expect more bugs than usual.
Apr 30 11:43:32.107 [notice] Read configuration file "/home/atagar/bad_torrc".
Apr 30 11:43:32.110 [warn] ControlPort is open, but no authentication method has been configured. This means that any program on your computer can reconfigure your Tor. That's bad! You should upgrade your Tor controller as soon as possible.
Apr 30 11:43:32.110 [notice] Scheduler type KIST has been enabled.
Apr 30 11:43:32.110 [notice] Opening Socks listener on 127.0.0.1:1234
Apr 30 11:43:32.110 [notice] Opening Control listener on 127.0.0.1:1234
Apr 30 11:43:32.110 [warn] Could not bind to 127.0.0.1:1234: Address already in use. Is Tor already running?
Apr 30 11:43:32.110 [notice] Closing partially-constructed Socks listener on 127.0.0.1:1234
Apr 30 11:43:32.110 [err] tor_assertion_failed_(): Bug: src/common/compat_libevent.c:388: mainloop_event_activate: Assertion event failed; aborting. (on Tor 0.3.4.0-alpha-dev d1a0534649be02e3)
Apr 30 11:43:32.111 [err] Bug: Assertion event failed in mainloop_event_activate at src/common/compat_libevent.c:388. Stack trace: (on Tor 0.3.4.0-alpha-dev d1a0534649be02e3)
Apr 30 11:43:32.111 [err] Bug: tor(log_backtrace+0x42) [0x55d0990d98b2] (on Tor 0.3.4.0-alpha-dev d1a0534649be02e3)
Apr 30 11:43:32.111 [err] Bug: tor(tor_assertion_failed_+0x8d) [0x55d0990f440d] (on Tor 0.3.4.0-alpha-dev d1a0534649be02e3)
Apr 30 11:43:32.111 [err] Bug: tor(mainloop_event_activate+0x5f) [0x55d09913857f] (on Tor 0.3.4.0-alpha-dev d1a0534649be02e3)
Apr 30 11:43:32.111 [err] Bug: tor(connection_mark_for_close_internal_+0x6c) [0x55d0990590fc] (on Tor 0.3.4.0-alpha-dev d1a0534649be02e3)
Apr 30 11:43:32.111 [err] Bug: tor(set_options+0x1b3) [0x55d09904d573] (on Tor 0.3.4.0-alpha-dev d1a0534649be02e3)
Apr 30 11:43:32.111 [err] Bug: tor(options_init_from_string+0x37e) [0x55d09904febe] (on Tor 0.3.4.0-alpha-dev d1a0534649be02e3)
Apr 30 11:43:32.111 [err] Bug: tor(options_init_from_torrc+0x433) [0x55d099050513] (on Tor 0.3.4.0-alpha-dev d1a0534649be02e3)
Apr 30 11:43:32.111 [err] Bug: tor(tor_init+0x2f0) [0x55d098faa620] (on Tor 0.3.4.0-alpha-dev d1a0534649be02e3)
Apr 30 11:43:32.111 [err] Bug: tor(tor_run_main+0x65) [0x55d098fab0c5] (on Tor 0.3.4.0-alpha-dev d1a0534649be02e3)
Apr 30 11:43:32.111 [err] Bug: tor(tor_main+0x3a) [0x55d098fa47da] (on Tor 0.3.4.0-alpha-dev d1a0534649be02e3)
Apr 30 11:43:32.111 [err] Bug: tor(main+0x19) [0x55d098fa4549] (on Tor 0.3.4.0-alpha-dev d1a0534649be02e3)
Apr 30 11:43:32.111 [err] Bug: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7f7a12ab4830] (on Tor 0.3.4.0-alpha-dev d1a0534649be02e3)
Apr 30 11:43:32.111 [err] Bug: tor(_start+0x29) [0x55d098fa4599] (on Tor 0.3.4.0-alpha-dev d1a0534649be02e3)
Aborted (core dumped)