stem
stem copied to clipboard
inodes_for_sockets error
Migrated from ticket 32049.
Running my ps.py for about 30 minutes at a Tor relay gives
port # opened closed max ( proc:9051, 6630 conns 0.24 sec )
5222 62 62 3 1 (Jabber)
5280 1 1 (None)
6660 4 2 (IRC)
6666 1 1 1 (IRC)
6667 1 3 1 1 (IRC)
6697 3 3 (IRC)
Traceback (most recent call last):
File "/usr/lib64/python3.6/site-packages/stem/util/proc.py", line 448, in _inodes_for_sockets
fd_name = os.readlink(fd_path)
FileNotFoundError: [Errno 2] No such file or directory: '/proc/2284/fd/5280'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/torutils/ps.py", line 178, in <module>
main()
File "/opt/torutils/ps.py", line 102, in main
connections = get_connections(resolver=resolver,process_pid=pid,process_name='tor')
File "/usr/lib64/python3.6/site-packages/stem/util/connection.py", line 236, in get_connections
return stem.util.proc.connections(pid = process_pid)
File "/usr/lib64/python3.6/site-packages/stem/util/proc.py", line 374, in connections
inodes = _inodes_for_sockets(pid) if pid else set()
File "/usr/lib64/python3.6/site-packages/stem/util/proc.py", line 457, in _inodes_for_sockets
raise IOError('unable to determine file descriptor destination (%s): %s' % (exc, fd_path))
OSError: unable to determine file descriptor destination ([Errno 2] No such file or directory: '/proc/2284/fd/5280'): /proc/2284/fd/5280
FWIW:
mr-fox ~ # ls /proc/2284/fd | wc
7148 7148 34630
mr-fox ~ # for p in 9051 ; do python /usr/share/doc/stem-1.7.1/_static/example/relay_connections.py --ctrlport $p; done
0.4.2.2-alpha uptime: 1-16:08:14 flags: Fast, Guard, Running, Stable, V2Dir, Valid
+------------------------------+------+------+
| Type | IPv4 | IPv6 |
+------------------------------+------+------+
| Inbound to our ORPort | 3661 | 4 |
| Inbound to our DirPort | 2 | 0 |
| Inbound to our ControlPort | 1 | 0 |
| Outbound to a relay | 2889 | 0 |
| Outbound exit traffic | 63 | 6 |
| Outbound uncategorized | 8 | 0 |
+------------------------------+------+------+
| Total | 6624 | 10 |
+------------------------------+------+------+
+------------------------------+------+------+
| Exit Port | IPv4 | IPv6 |
+------------------------------+------+------+
| 5222 (Jabber) | 54 | 5 |
| 5280 | 1 | 0 |
| 6667 (IRC) | 6 | 0 |
| 6697 (IRC) | 2 | 1 |
+------------------------------+------+------+
| Total | 63 | 6 |
+------------------------------+------+------+