giampaolo / psutil

Cross-platform lib for process and system monitoring in Python
BSD 3-Clause "New" or "Revised" License
10.25k stars 1.38k forks source link

error while parsing /proc/net/unix (psutil 3.2.0) #766

Closed teto closed 8 years ago

teto commented 8 years ago

I have a script that tries to find unix socket from pid and it recently started to fail with:

Could not find neovim socket error while parsing /proc/net/unix; malformed line '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n'
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/psutil-3.2.0-py3.4-linux-x86_64.egg/psutil/_pslinux.py", line 525, in process_unix
    _, _, _, _, type_, _, inode = tokens[0:7]
ValueError: need more than 1 value to unpack

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/teto/.i3/i3dispatch.py", line 115, in get_nvim_socket
    unix_sockets = child.connections(kind="unix")
  File "/usr/local/lib/python3.4/dist-packages/psutil-3.2.0-py3.4-linux-x86_64.egg/psutil/__init__.py", line 1010, in connections
    return self._proc.connections(kind)
  File "/usr/local/lib/python3.4/dist-packages/psutil-3.2.0-py3.4-linux-x86_64.egg/psutil/_pslinux.py", line 722, in wrapper
    return fun(self, *args, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/psutil-3.2.0-py3.4-linux-x86_64.egg/psutil/_pslinux.py", line 1178, in connections
    ret = _connections.retrieve(kind, self.pid)
  File "/usr/local/lib/python3.4/dist-packages/psutil-3.2.0-py3.4-linux-x86_64.egg/psutil/_pslinux.py", line 568, in retrieve
    for fd, family, type_, laddr, raddr, status, bound_pid in ls:
  File "/usr/local/lib/python3.4/dist-packages/psutil-3.2.0-py3.4-linux-x86_64.egg/psutil/_pslinux.py", line 529, in process_unix
    file, line))
RuntimeError: error while parsing /proc/net/unix; malformed line '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\n'

and here is my unix

Num       RefCount Protocol Flags    Type St Inode Path
0000000000000000: 00000002 00000000 00000000 0002 01 16327 /var/spool/postfix/dev/log
0000000000000000: 00000002 00000000 00000000 0002 01 22983 /run/user/1000/systemd/notify
0000000000000000: 00000002 00000000 00010000 0001 01 22984 /run/user/1000/systemd/private
0000000000000000: 00000002 00000000 00010000 0005 01 12354 /run/udev/control
0000000000000000: 00000002 00000000 00010000 0001 01 22890 /tmp/.X11-unix/X0
0000000000000000: 00000002 00000000 00010000 0001 01 22889 @/tmp/.X11-unix/X0
0000000000000000: 00000002 00000000 00010000 0001 01 29155 @/tmp/dbus-Zi7EGdAy17
0000000000000000: 00000002 00000000 00010000 0001 01 22286 /tmp/ssh-iw7pZyiQTSIJ/agent.1675
0000000000000000: 00000002 00000000 00010000 0001 01 23354 /tmp/gpg-SjZdHc/S.gpg-agent
0000000000000000: 00000002 00000000 00010000 0001 01 37238 /tmp/nvimBhLHnX/0
0000000000000000: 00000002 00000000 00010000 0001 01 25417 /home/teto/.i3/ipc.sock
0000000000000000: 00000002 00000000 00010000 0001 01 64582 /tmp/nvimXd72B5/0
0000000000000000: 00000002 00000000 00010000 0001 01 15259 /var/run/cups/cups.sock
0000000000000000: 00000002 00000000 00010000 0001 01 56201 /tmp/nvimwyQbA9/0
0000000000000000: 00000002 00000000 00010000 0001 01 15260 /var/run/dbus/system_bus_socket
0000000000000000: 00000002 00000000 00010000 0001 01 15713 /run/rpcbind.sock
0000000000000000: 00000002 00000000 00010000 0001 01 22616 /var/lib/samba/winbindd_privileged/pipe
0000000000000000: 00000002 00000000 00010000 0001 01 15261 /run/uuidd/request
0000000000000000: 00000002 00000000 00010000 0001 01 15264 /var/run/avahi-daemon/socket
0000000000000000: 00000002 00000000 00010000 0001 01 15265 /run/acpid.socket
0000000000000000: 00000002 00000000 00010000 0001 01 18521 /var/run/NetworkManager/private
0000000000000000: 00000002 00000000 00010000 0001 01 19454 /var/run/openvswitch/ovs-vswitchd.1566.ctl
0000000000000000: 00000002 00000000 00010000 0001 01 19395 /var/run/uml-utilities/uml_switch.ctl
0000000000000000: 00000002 00000000 00010000 0001 01 21449 /var/run/openvswitch/ovs-testcontroller.1528.ctl
0000000000000000: 00000002 00000000 00010000 0001 01 19413 /var/run/openvswitch/db.sock
0000000000000000: 00000002 00000000 00010000 0001 01 19414 /var/run/openvswitch/ovsdb-server.1551.ctl
0000000000000000: 00000002 00000000 00010000 0001 01 21550 /var/run/samba/winbindd/pipe
0000000000000000: 00000002 00000000 00010000 0001 01 18353 /var/run/samba/nmbd/unexpected
0000000000000000: 00000002 00000000 00010000 0001 01 23076 /var/run/NetworkManager/private-dhcp
0000000000000000: 00000002 00000000 00000000 0002 01 21901 /run/wpa_supplicant/wlan0
0000000000000000: 00000002 00000000 00000000 0002 01 12332 /run/systemd/notify
0000000000000000: 00000002 00000000 00010000 0001 01 12333 /run/systemd/private
0000000000000000: 00000002 00000000 00010000 0001 01 12351 /run/lvm/lvmpolld.socket
0000000000000000: 00000017 00000000 00000000 0002 01 12352 /run/systemd/journal/dev-log
0000000000000000: 00000002 00000000 00010000 0001 01 12353 /run/lvm/lvmetad.socket
0000000000000000: 00000002 00000000 00010000 0001 01 12356 /run/systemd/fsck.progress
0000000000000000: 00000002 00000000 00010000 0001 01 12357 /run/systemd/journal/stdout
0000000000000000: 00000006 00000000 00000000 0002 01 12358 /run/systemd/journal/socket
0000000000000000: 00000002 00000000 00000000 0002 01 19396 @��E

0000000000000000: 00000002 00000000 00000000 0002 01 12386 /run/systemd/journal/syslog
0000000000000000: 00000002 00000000 00010000 0001 01 24557 @/tmp/dbus-ZoHxAnr8bD
0000000000000000: 00000003 00000000 00000000 0001 03 62985
0000000000000000: 00000003 00000000 00000000 0001 03 38096
0000000000000000: 00000003 00000000 00000000 0001 03 21746
0000000000000000: 00000003 00000000 00000000 0001 03 28087
0000000000000000: 00000003 00000000 00000000 0001 03 24799
0000000000000000: 00000002 00000000 00000000 0002 01 21316
0000000000000000: 00000002 00000000 00000000 0002 01 16302
0000000000000000: 00000003 00000000 00000000 0001 03   407 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 28043
0000000000000000: 00000003 00000000 00000000 0001 03 17275
0000000000000000: 00000003 00000000 00000000 0001 03 14251 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 29161 @/tmp/dbus-Zi7EGdAy17
0000000000000000: 00000003 00000000 00000000 0001 03 60273 @/tmp/dbus-ZoHxAnr8bD
0000000000000000: 00000003 00000000 00000000 0001 03 39041 @/tmp/dbus-ZoHxAnr8bD
0000000000000000: 00000003 00000000 00000000 0001 03 29281 /var/run/dbus/system_bus_socket
0000000000000000: 00000002 00000000 00000000 0002 01 21669
0000000000000000: 00000003 00000000 00000000 0001 03 35402
0000000000000000: 00000003 00000000 00000000 0001 03 29177 @/tmp/dbus-ZoHxAnr8bD
0000000000000000: 00000003 00000000 00000000 0001 03 57942
0000000000000000: 00000003 00000000 00000000 0001 03 33156
0000000000000000: 00000003 00000000 00000000 0001 03 27216 @/tmp/.X11-unix/X0
0000000000000000: 00000003 00000000 00000000 0001 03 16870
0000000000000000: 00000003 00000000 00000000 0001 03 37268
0000000000000000: 00000003 00000000 00000000 0001 03 22308
0000000000000000: 00000003 00000000 00000000 0001 03 22960 @/tmp/.X11-unix/X0
0000000000000000: 00000002 00000000 00000000 0002 01 15916
0000000000000000: 00000003 00000000 00000000 0001 03 59063
0000000000000000: 00000003 00000000 00000000 0001 03 29159
0000000000000000: 00000003 00000000 00000000 0001 03 28075 @/tmp/.X11-unix/X0
0000000000000000: 00000003 00000000 00000000 0001 03 41197
0000000000000000: 00000003 00000000 00000000 0001 03 36585
0000000000000000: 00000003 00000000 00000000 0001 03 28520 /var/run/dbus/system_bus_socket
0000000000000000: 00000003 00000000 00000000 0001 03 59068
0000000000000000: 00000003 00000000 00000000 0001 03 42620
0000000000000000: 00000002 00000000 00000000 0001 03 18877
0000000000000000: 00000003 00000000 00000000 0001 03 28071 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 20485 /var/run/dbus/system_bus_socket
0000000000000000: 00000003 00000000 00000000 0001 03 63219
0000000000000000: 00000003 00000000 00000000 0001 03 29143 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 51777
0000000000000000: 00000003 00000000 00000000 0001 03 22300 @/tmp/.X11-unix/X0
0000000000000000: 00000002 00000000 00000000 0002 01 20579
0000000000000000: 00000003 00000000 00000000 0001 03 22971 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 18388 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 25748 @/tmp/.X11-unix/X0
0000000000000000: 00000003 00000000 00000000 0001 03 57901
0000000000000000: 00000003 00000000 00000000 0001 03 28134
0000000000000000: 00000002 00000000 00000000 0002 01 24165
0000000000000000: 00000003 00000000 00000000 0001 03 59064
0000000000000000: 00000002 00000000 00000000 0002 01 18520
0000000000000000: 00000003 00000000 00000000 0001 03 57005
0000000000000000: 00000003 00000000 00000000 0001 03 35919 @/tmp/dbus-ZoHxAnr8bD
0000000000000000: 00000002 00000000 00000000 0002 01 16288
0000000000000000: 00000003 00000000 00000000 0001 03 15919
0000000000000000: 00000002 00000000 00000000 0002 01 25285
0000000000000000: 00000003 00000000 00000000 0001 03 22287 @/tmp/.X11-unix/X0
0000000000000000: 00000003 00000000 00000000 0001 03 21648 /var/run/dbus/system_bus_socket
0000000000000000: 00000003 00000000 00000000 0001 03 35353
0000000000000000: 00000003 00000000 00000000 0001 03 19542
0000000000000000: 00000003 00000000 00000000 0001 03 18516 /var/run/dbus/system_bus_socket
0000000000000000: 00000003 00000000 00000000 0001 03 15922 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 37251
0000000000000000: 00000003 00000000 00000000 0001 03 14322
0000000000000000: 00000003 00000000 00000000 0001 03 13990
0000000000000000: 00000003 00000000 00000000 0001 03 62984 @/tmp/.X11-unix/X0
0000000000000000: 00000003 00000000 00000000 0001 03 23374 @/tmp/dbus-ZoHxAnr8bD
0000000000000000: 00000003 00000000 00000000 0001 03 23366
0000000000000000: 00000003 00000000 00000000 0001 03 26367
0000000000000000: 00000003 00000000 00000000 0001 03 15920
0000000000000000: 00000003 00000000 00000000 0001 03 28135 /var/run/dbus/system_bus_socket
0000000000000000: 00000003 00000000 00000000 0001 03 28073 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 59066
0000000000000000: 00000003 00000000 00000000 0001 03 28042
0000000000000000: 00000003 00000000 00000000 0001 03 20649 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 18593
0000000000000000: 00000003 00000000 00000000 0001 03 29195 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 15900 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 29176 @/tmp/.X11-unix/X0
0000000000000000: 00000003 00000000 00000000 0001 03 26358
0000000000000000: 00000003 00000000 00000000 0001 03 21272 /var/run/dbus/system_bus_socket
0000000000000000: 00000003 00000000 00000000 0002 01 12596
0000000000000000: 00000003 00000000 00000000 0001 03 62981
0000000000000000: 00000003 00000000 00000000 0005 03 39387
0000000000000000: 00000003 00000000 00000000 0001 03 37254
0000000000000000: 00000003 00000000 00000000 0001 03 38957 /var/run/dbus/system_bus_socket
0000000000000000: 00000003 00000000 00000000 0001 03 20121
0000000000000000: 00000003 00000000 00000000 0001 03 24974
0000000000000000: 00000003 00000000 00000000 0001 03 36677 @/tmp/.X11-unix/X0
0000000000000000: 00000003 00000000 00000000 0001 03 17105
0000000000000000: 00000003 00000000 00000000 0001 03 56181 @/tmp/dbus-ZoHxAnr8bD
0000000000000000: 00000003 00000000 00000000 0001 03 22307
0000000000000000: 00000003 00000000 00000000 0001 03 20112
0000000000000000: 00000003 00000000 00000000 0001 03 18950
0000000000000000: 00000003 00000000 00000000 0001 03 17510
0000000000000000: 00000003 00000000 00000000 0001 03 36689
0000000000000000: 00000003 00000000 00000000 0001 03 57006 @/tmp/dbus-Zi7EGdAy17
0000000000000000: 00000003 00000000 00000000 0001 03 23767
0000000000000000: 00000003 00000000 00000000 0001 03 51776
0000000000000000: 00000003 00000000 00000000 0001 03 38229
0000000000000000: 00000003 00000000 00000000 0001 03 35350
0000000000000000: 00000003 00000000 00000000 0001 03 23751
0000000000000000: 00000003 00000000 00000000 0001 03 42001
0000000000000000: 00000003 00000000 00000000 0001 03 39048 @/tmp/dbus-ZoHxAnr8bD
0000000000000000: 00000003 00000000 00000000 0001 03 29145 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 16304
0000000000000000: 00000002 00000000 00000000 0002 01 16038
0000000000000000: 00000003 00000000 00000000 0001 03 59067
0000000000000000: 00000003 00000000 00000000 0001 03 59065
0000000000000000: 00000003 00000000 00000000 0001 03 22305
0000000000000000: 00000003 00000000 00000000 0001 03 19404 /var/run/dbus/system_bus_socket
0000000000000000: 00000003 00000000 00000000 0001 03 60272 @/tmp/dbus-Zi7EGdAy17
0000000000000000: 00000003 00000000 00000000 0001 03 31707 @/tmp/dbus-ZoHxAnr8bD
0000000000000000: 00000003 00000000 00000000 0001 03 28076 @/tmp/dbus-Zi7EGdAy17
0000000000000000: 00000003 00000000 00000000 0001 03 22968
0000000000000000: 00000003 00000000 00000000 0001 03 21503 /var/run/openvswitch/db.sock
0000000000000000: 00000003 00000000 00000000 0001 03 37249
0000000000000000: 00000003 00000000 00000000 0001 03 33649 @/tmp/.X11-unix/X0
0000000000000000: 00000003 00000000 00000000 0001 03 32344 @/tmp/dbus-ZoHxAnr8bD
0000000000000000: 00000003 00000000 00000000 0001 03 38111
0000000000000000: 00000003 00000000 00000000 0001 03 25418 /home/teto/.i3/ipc.sock
0000000000000000: 00000003 00000000 00000000 0002 01 12597
0000000000000000: 00000003 00000000 00000000 0001 03 15979
0000000000000000: 00000002 00000000 00000000 0002 01 28482
0000000000000000: 00000003 00000000 00000000 0001 03 21271
0000000000000000: 00000003 00000000 00000000 0001 03 24558 @/tmp/.X11-unix/X0
0000000000000000: 00000002 00000000 00000000 0002 01 18514
0000000000000000: 00000003 00000000 00000000 0001 03 14323 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 14253 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 15921 /var/run/dbus/system_bus_socket
0000000000000000: 00000003 00000000 00000000 0001 03 63218
0000000000000000: 00000003 00000000 00000000 0001 03 20483 /var/run/dbus/system_bus_socket
0000000000000000: 00000002 00000000 00000000 0002 01 12557
0000000000000000: 00000003 00000000 00000000 0001 03 28038 @/tmp/dbus-ZoHxAnr8bD
0000000000000000: 00000003 00000000 00000000 0001 03 24159
0000000000000000: 00000002 00000000 00000000 0002 01 22969
0000000000000000: 00000003 00000000 00000000 0001 03 30820
0000000000000000: 00000003 00000000 00000000 0001 03 20484
0000000000000000: 00000003 00000000 00000000 0001 03 37250
0000000000000000: 00000002 00000000 00000000 0002 01 10726
0000000000000000: 00000003 00000000 00000000 0001 03 13989
0000000000000000: 00000003 00000000 00000000 0001 03 30726
0000000000000000: 00000003 00000000 00000000 0001 03 17729 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 17725 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 18515 /var/run/dbus/system_bus_socket
0000000000000000: 00000003 00000000 00000000 0001 03 18484 /var/run/dbus/system_bus_socket
0000000000000000: 00000003 00000000 00000000 0001 03 15891 /run/systemd/journal/stdout
0000000000000000: 00000002 00000000 00000000 0002 01 19442
0000000000000000: 00000002 00000000 00000000 0002 01 24672
0000000000000000: 00000003 00000000 00000000 0001 03 26369
0000000000000000: 00000003 00000000 00000000 0001 03 22617
0000000000000000: 00000003 00000000 00000000 0001 03 17553 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 21284
0000000000000000: 00000003 00000000 00000000 0001 03 40634 @/tmp/dbus-Zi7EGdAy17
0000000000000000: 00000003 00000000 00000000 0001 03 28088
0000000000000000: 00000003 00000000 00000000 0001 03 25416
0000000000000000: 00000002 00000000 00000000 0001 03 45077
0000000000000000: 00000003 00000000 00000000 0001 03 12482
0000000000000000: 00000003 00000000 00000000 0001 03 33154
0000000000000000: 00000003 00000000 00000000 0001 03 28468 @/tmp/dbus-ZoHxAnr8bD
0000000000000000: 00000003 00000000 00000000 0001 03 25422 @/tmp/.X11-unix/X0
0000000000000000: 00000003 00000000 00000000 0001 03 18038 /var/run/dbus/system_bus_socket
0000000000000000: 00000003 00000000 00000000 0001 03 16993
0000000000000000: 00000003 00000000 00000000 0001 03 40635 @/tmp/.X11-unix/X0
0000000000000000: 00000003 00000000 00000000 0001 03 17276 /var/run/dbus/system_bus_socket
0000000000000000: 00000003 00000000 00000000 0001 03 26355
0000000000000000: 00000003 00000000 00000000 0001 03 16099
0000000000000000: 00000003 00000000 00000000 0001 03 63220
0000000000000000: 00000003 00000000 00000000 0001 03 23365
0000000000000000: 00000003 00000000 00000000 0001 03 36593 /var/run/dbus/system_bus_socket
0000000000000000: 00000003 00000000 00000000 0001 03 33875
0000000000000000: 00000003 00000000 00000000 0001 03 39040 @/tmp/dbus-ZoHxAnr8bD
0000000000000000: 00000003 00000000 00000000 0001 03 30118 @/tmp/dbus-Zi7EGdAy17
0000000000000000: 00000003 00000000 00000000 0001 03 22294 @/tmp/.X11-unix/X0
0000000000000000: 00000003 00000000 00000000 0001 03 62983
0000000000000000: 00000003 00000000 00000000 0001 03 19356 /var/run/dbus/system_bus_socket
0000000000000000: 00000002 00000000 00000000 0002 01 19397
0000000000000000: 00000003 00000000 00000000 0001 03 14249
0000000000000000: 00000003 00000000 00000000 0001 03 20123
0000000000000000: 00000002 00000000 00000000 0002 01 19555
0000000000000000: 00000003 00000000 00000000 0001 03 19479
0000000000000000: 00000003 00000000 00000000 0001 03 12555 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 63215
0000000000000000: 00000003 00000000 00000000 0001 03 28047 @/tmp/dbus-ZoHxAnr8bD
0000000000000000: 00000003 00000000 00000000 0001 03 24640 /var/run/dbus/system_bus_socket
0000000000000000: 00000002 00000000 00000000 0002 01 15701
0000000000000000: 00000003 00000000 00000000 0001 03 19340
0000000000000000: 00000003 00000000 00000000 0001 03 30175 @/tmp/dbus-ZoHxAnr8bD
0000000000000000: 00000003 00000000 00000000 0001 03 40313 /var/run/dbus/system_bus_socket
0000000000000000: 00000003 00000000 00000000 0001 03 57902 @/tmp/.X11-unix/X0
0000000000000000: 00000003 00000000 00000000 0001 03 23360
0000000000000000: 00000003 00000000 00000000 0001 03 19469 /var/run/dbus/system_bus_socket
0000000000000000: 00000003 00000000 00000000 0001 03 17160
0000000000000000: 00000003 00000000 00000000 0001 03 39047
0000000000000000: 00000003 00000000 00000000 0001 03 25743 @/tmp/.X11-unix/X0
0000000000000000: 00000003 00000000 00000000 0001 03 26373
0000000000000000: 00000003 00000000 00000000 0001 03 24549
0000000000000000: 00000003 00000000 00000000 0001 03 19455
0000000000000000: 00000003 00000000 00000000 0001 03 35352
0000000000000000: 00000003 00000000 00000000 0001 03 20072
0000000000000000: 00000003 00000000 00000000 0001 03 39468
0000000000000000: 00000003 00000000 00000000 0001 03 37253
0000000000000000: 00000003 00000000 00000000 0001 03 63217
0000000000000000: 00000003 00000000 00000000 0001 03 29283
0000000000000000: 00000003 00000000 00000000 0001 03 26372
0000000000000000: 00000003 00000000 00000000 0001 03 25082 /var/run/dbus/system_bus_socket
0000000000000000: 00000003 00000000 00000000 0001 03 28519
0000000000000000: 00000003 00000000 00000000 0001 03 28091
0000000000000000: 00000003 00000000 00000000 0001 03 34331 /tmp/ssh-iw7pZyiQTSIJ/agent.1675
0000000000000000: 00000003 00000000 00000000 0001 03 18522
0000000000000000: 00000003 00000000 00000000 0001 03 17405 /var/run/dbus/system_bus_socket
0000000000000000: 00000003 00000000 00000000 0001 03 28089 @/tmp/dbus-ZoHxAnr8bD
0000000000000000: 00000003 00000000 00000000 0001 03 23867 @/tmp/.X11-unix/X0
0000000000000000: 00000003 00000000 00000000 0001 03 26364
0000000000000000: 00000003 00000000 00000000 0001 03 19352 /var/run/dbus/system_bus_socket
0000000000000000: 00000003 00000000 00000000 0001 03 39035
0000000000000000: 00000003 00000000 00000000 0001 03 32342 @/tmp/.X11-unix/X0
0000000000000000: 00000003 00000000 00000000 0001 03 33648 @/tmp/dbus-Zi7EGdAy17
0000000000000000: 00000003 00000000 00000000 0001 03   457
0000000000000000: 00000002 00000000 00000000 0002 01 21949
0000000000000000: 00000003 00000000 00000000 0001 03 36683
0000000000000000: 00000003 00000000 00000000 0001 03 19351 /var/run/dbus/system_bus_socket
0000000000000000: 00000003 00000000 00000000 0001 03 16100 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 14264 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 28132 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 29160
0000000000000000: 00000003 00000000 00000000 0001 03 31705 @/tmp/dbus-Zi7EGdAy17
0000000000000000: 00000003 00000000 00000000 0001 03 18483
0000000000000000: 00000003 00000000 00000000 0001 03 16036 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 29197 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 18390
0000000000000000: 00000003 00000000 00000000 0001 03 28467
0000000000000000: 00000003 00000000 00000000 0001 03 57943
0000000000000000: 00000003 00000000 00000000 0001 03 16290
0000000000000000: 00000003 00000000 00000000 0001 03 33214
0000000000000000: 00000003 00000000 00000000 0001 03 30727
0000000000000000: 00000003 00000000 00000000 0001 03 40636 @/tmp/dbus-ZoHxAnr8bD
0000000000000000: 00000003 00000000 00000000 0001 03 39890
0000000000000000: 00000003 00000000 00000000 0001 03 37269
0000000000000000: 00000003 00000000 00000000 0001 03 32263
0000000000000000: 00000002 00000000 00000000 0002 01 19411
0000000000000000: 00000003 00000000 00000000 0001 03 25421
0000000000000000: 00000003 00000000 00000000 0001 03 16272 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 29166
0000000000000000: 00000003 00000000 00000000 0001 03 29165
0000000000000000: 00000003 00000000 00000000 0001 03 21681 /run/acpid.socket
0000000000000000: 00000003 00000000 00000000 0001 03 59012
0000000000000000: 00000003 00000000 00000000 0001 03 19478
0000000000000000: 00000003 00000000 00000000 0001 03 20113 /var/run/dbus/system_bus_socket
0000000000000000: 00000003 00000000 00000000 0001 03 23060 /var/run/dbus/system_bus_socket
0000000000000000: 00000003 00000000 00000000 0001 03 26362
0000000000000000: 00000002 00000000 00000000 0002 01 21283
0000000000000000: 00000003 00000000 00000000 0001 03 16330
0000000000000000: 00000003 00000000 00000000 0001 03 21259 /run/systemd/journal/stdout
0000000000000000: 00000003 00000000 00000000 0001 03 44780 @/tmp/.X11-unix/X0
0000000000000000: 00000003 00000000 00000000 0001 03 38228
0000000000000000: 00000003 00000000 00000000 0001 03 23359
0000000000000000: 00000003 00000000 00000000 0001 03 16295
0000000000000000: 00000003 00000000 00000000 0001 03 18042
0000000000000000: 00000003 00000000 00000000 0001 03 23730
0000000000000000: 00000003 00000000 00000000 0001 03 16044
0000000000000000: 00000003 00000000 00000000 0001 03 63988
0000000000000000: 00000003 00000000 00000000 0001 03 63987
0000000000000000: 00000003 00000000 00000000 0001 03 31706 @/tmp/.X11-unix/X0
0000000000000000: 00000003 00000000 00000000 0001 03 23371 @/tmp/.X11-unix/X0
0000000000000000: 00000003 00000000 00000000 0001 03 22288
0000000000000000: 00000003 00000000 00000000 0001 03 63216
0000000000000000: 00000003 00000000 00000000 0001 03 26368
0000000000000000: 00000003 00000000 00000000 0001 03 24562
0000000000000000: 00000003 00000000 00000000 0001 03 22618
0000000000000000: 00000003 00000000 00000000 0001 03 18043
0000000000000000: 00000003 00000000 00000000 0001 03 38089 /run/systemd/journal/stdout
0000000000000000: 00000002 00000000 00000000 0002 01 21751
0000000000000000: 00000002 00000000 00000000 0002 01 20068
0000000000000000: 00000003 00000000 00000000 0005 03 39388
0000000000000000: 00000003 00000000 00000000 0001 03 37252
0000000000000000: 00000003 00000000 00000000 0001 03 29280
0000000000000000: 00000003 00000000 00000000 0001 03 25745 @/tmp/.X11-unix/X0
0000000000000000: 00000003 00000000 00000000 0001 03 16291
0000000000000000: 00000003 00000000 00000000 0001 03 29194 @/tmp/dbus-ZoHxAnr8bD
0000000000000000: 00000003 00000000 00000000 0001 03 29202 @/tmp/dbus-ZoHxAnr8bD
0000000000000000: 00000003 00000000 00000000 0001 03 22298
0000000000000000: 00000003 00000000 00000000 0001 03 15280
0000000000000000: 00000003 00000000 00000000 0001 03 19405 /var/run/dbus/system_bus_socket

and here is the code that might have triggered it:

        try:
                pid = subprocess.check_output("xdotool getwindowfocus getwindowpid", shell=True).decode()
                pid = pid.rstrip()
                pid = int(pid)
                log.debug("Retreived terminal pid %d, nvim should be one of its children" % pid)
                proc = psutil.Process( pid)
                log.debug( "proc name %s with %d children" % (proc.name(), len(proc.children(recursive=True))))
                for child in proc.children(recursive=True):
                        log.debug("child name & pid %s/%d" % (child.name(), child.pid))
                        if child.name() == "nvim":
                                unix_sockets = child.connections(kind="unix")
                                log.debug("Found an nvim subprocess with %d " % len(unix_sockets))
                                # look for socket 
                                # for filename, fd in child.open_files():
                                # log.debug("Open file %s " % filename)
                                for con in unix_sockets:
                                        filename = con.laddr
                                        log.debug("Socket %s " % filename)
                                        if "/tmp/nvim" in filename:
                                                log.debug("Found a match: %s" % filename) 
                                                return True, filename
                                return False, ""
        except Exception as e:
                log.error('Could not find neovim socket %s' % e)
                log.error(traceback.format_exc())
                return False, ""

My version is 3.2.0

psutil.version '3.2.0'

giampaolo commented 8 years ago

Can you try with latest GIT version?

teto commented 8 years ago

Installed with python3.4 -mpip install -U https://github.com/giampaolo/psutil/archive/master.zip and doesn't seem to fix it, should it ?

teto commented 8 years ago

thanks ! I can't really confirm if the fix works since it depends on what I launch on my machine I guess but in the contrary you will see me again :)

2016-02-15 15:50 GMT+01:00 giampaolo notifications@github.com:

Closed #766 https://github.com/giampaolo/psutil/issues/766 via 897e758 https://github.com/giampaolo/psutil/commit/897e758a6a5ff749bfd0c8c5ea934d5a27e51f17 .

— Reply to this email directly or view it on GitHub https://github.com/giampaolo/psutil/issues/766#event-550766838.

teto commented 8 years ago

Tested it. It works ty.