Closed atagar closed 3 years ago
Hi toralf, sorry this went a full year without a reply. I just traced stem with the ss output you cite above and it seems to work.
That output lists four different tor pids, indicating multiple tor processes. relay_connections.py narrows its results to the control port's pid, so I suspect the issue here is that it isn't among them.
Feel free to reopen if you have any other questions.
Similar problem here at a system with 2 relays at the same hardware and the same ip address:
mr-fox ~ # python /usr/share/doc/stem-1.8.0/_static/example/relay_connections.py --ctrlport 9051 --resolver ss
0.4.5.0-alpha-dev uptime: 22:23:09 flags: Fast, Guard, Running, Stable, V2Dir, Valid
Traceback (most recent call last):
File "/usr/share/doc/stem-1.8.0/_static/example/relay_connections.py", line 130, in <module>
main()
File "/usr/share/doc/stem-1.8.0/_static/example/relay_connections.py", line 66, in main
for conn in get_connections(resolver = args.resolver, process_pid = pid):
File "/usr/lib/python3.7/site-packages/stem/util/connection.py", line 348, in get_connections
raise IOError('No results found using: %s' % resolver_command)
OSError: No results found using: ss -nptu
mr-fox ~ # python /usr/share/doc/stem-1.8.0/_static/example/relay_connections.py --ctrlport 9051 --resolver lsof
0.4.5.0-alpha-dev uptime: 22:23:28 flags: Fast, Guard, Running, Stable, V2Dir, Valid
+------------------------------+------+------+
| Type | IPv4 | IPv6 |
+------------------------------+------+------+
| Inbound to our ControlPort | 1 | 0 |
| Outbound to a relay | 3709 | 0 |
| Outbound exit traffic | 60 | 5 |
| Outbound uncategorized | 4509 | 11 |
+------------------------------+------+------+
| Total | 8279 | 16 |
+------------------------------+------+------+
+------------------------------+------+------+
| Exit Port | IPv4 | IPv6 |
+------------------------------+------+------+
| 853 | 4 | 0 |
| 5222 (Jabber) | 42 | 1 |
| 5223 (Jabber) | 13 | 1 |
| 6667 (IRC) | 0 | 2 |
| 6697 (IRC) | 0 | 1 |
| 7777 | 1 | 0 |
+------------------------------+------+------+
| Total | 60 | 5 |
+------------------------------+------+------+
mr-fox ~ # python /usr/share/doc/stem-1.8.0/_static/example/relay_connections.py --ctrlport 29051 --resolver lsof
0.4.5.0-alpha-dev uptime: 22:23:50 flags: Fast, Guard, Running, Stable, V2Dir, Valid
+------------------------------+------+------+
| Type | IPv4 | IPv6 |
+------------------------------+------+------+
| Inbound to our ControlPort | 1 | 0 |
| Outbound to a relay | 3947 | 0 |
| Outbound exit traffic | 54 | 4 |
| Outbound uncategorized | 4216 | 8 |
+------------------------------+------+------+
| Total | 8218 | 12 |
+------------------------------+------+------+
+------------------------------+------+------+
| Exit Port | IPv4 | IPv6 |
+------------------------------+------+------+
| 853 | 4 | 0 |
| 5222 (Jabber) | 38 | 3 |
| 5223 (Jabber) | 10 | 0 |
| 6667 (IRC) | 2 | 1 |
+------------------------------+------+------+
| Total | 54 | 4 |
+------------------------------+------+------+
The first relay runs at pid 2238 (ok), the 2nd at 2269 (wrong). I will attach outputs of
mr-fox ~ # ss -nptu -6 > ss.6
mr-fox ~ # ss -nptu -4 > ss.4
soon.
mr-fox ~ # pgrep -af /usr/bin/tor
2238 /usr/bin/tor -f /etc/tor/torrc --hush --runasdaemon 1 --pidfile /run/tor/tor.pid
2269 /usr/bin/tor -f /etc/tor/torrc2 --hush --runasdaemon 1 --pidfile /run/tor/tor2.pid
mr-fox ~ # python -V
Python 3.7.8
Thanks toralf. Two questions...
Thanks toralf. Two questions...
1. What is the output of 'ss -nptu' without the '-4' or '-6' arguments that you included?
Out put of
ss -nptu &> ss-nptu.log
and
for r in proc lsof netstat ss; do for p in 9051 29051; do echo "resolver=$r ctrlpor=$p"; python /usr/share/doc/stem-1.8.0/_static/example/relay_connections.py --ctrlport $p --resolver $r; done; done 2>&1 | tee rc.log
will be attached soon.
- Which tor pid belongs to control port 9051(ie, the one that errors)? pid 2238 belongs to 9051 and pid 2269 belongs to 29051.
Ah! Finally figured out what's up. Your copy of 'ss' appends trailing whitespace that I don't expect. Fixed and added a test...
https://gitweb.torproject.org/stem.git/commit/?id=8a00dcb
Thanks for pointing this out!
Migrated from ticket 31551.
I do get :
at a hardened stable Gentoo Linux with kernel 5.2.10 and sys-apps/iproute2-4.19.0-r1 (provides "ss"), but th ecomamdn itself prints :
All other 3 resolvers are fine and do print something like