liske / needrestart

Restart daemons after library updates.
GNU General Public License v2.0
420 stars 67 forks source link

Outdated user processes no longer have names #218

Closed yochananmarqos closed 2 years ago

yochananmarqos commented 2 years ago

With the latest commit 5c20a9e on Manjaro GNOME (unstable branch):

❯ needrestart -v
[main] eval /etc/needrestart/needrestart.conf
[main] needrestart v3.5
[main] running in user mode
[Core] Using UI 'NeedRestart::UI::stdio'...
[main] systemd detected
[main] #1967 uses deleted /usr/lib/libcrypt.so.2.0.0
[Core] #1976 is a NeedRestart::Interp::Python
[Python] #1976: source file not found, skipping
[Python] #1976:  reduced ARGV:                             
[main] #1980 uses deleted /usr/lib/libcrypt.so.2.0.0
[main] #2258 uses deleted /usr/lib/libcrypt.so.2.0.0
[Core] #2651 is a NeedRestart::Interp::Python
[Python] #2651: source=/usr/lib/system76-driver/system76-user-daemon
[Core] #2881 is a NeedRestart::Interp::Python
[Python] #2881: source=/usr/bin/cast_control
[main] #3670 uses deleted /usr/lib/libcrypt.so.2.0.0
[Core] #3699 is a NeedRestart::Interp::Python
[Python] #3699: source=/usr/lib/python3.9/site-packages/rabbitvcs/services/checkerservice.py
[main] #32198 uses deleted /usr/lib/libimagequant.so.0
[Core] #32202 is a NeedRestart::Interp::Python
[Python] #32202: source=/usr/bin/gssp-recoll.py
[Core] #543425 is a NeedRestart::Interp::Python
[Python] #543425: source=/usr/bin/chrome-gnome-shell
Your outdated processes:
d[2258, 1980], n[3670], p[32198], s[1967]
❯ ps aux | grep 1980
yochanan    1980  0.0  0.0  16288  8464 ?        Ss   Sep20   0:06 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
yochanan  589947  0.0  0.0   6492  2452 pts/0    S+   09:31   0:00 grep --color=auto 1980
❯ ps aux | grep 3670
yochanan    3670  0.0  0.6 2408332 207152 ?      Sl   Sep20   1:01 /usr/bin/nautilus --gapplication-service
yochanan  590650  0.0  0.0   6492  2392 pts/0    S+   09:34   0:00 grep --color=auto 3670
❯ ps aux | grep 32198
yochanan   32198  0.0  0.1 340948 62268 ?        Sl   Sep20   0:00 python3 /usr/lib/lollypop/lollypop-sp
yochanan  590765  0.0  0.0   6492  2316 pts/0    S+   09:34   0:00 grep --color=auto 32198
❯ ps aux | grep 1967
yochanan    1967  0.0  0.0  17744 10700 ?        Ss   Sep20   0:04 /usr/lib/systemd/systemd --user
yochanan  590863  0.0  0.0   6492  2400 pts/0    S+   09:34   0:00 grep --color=auto 1967
aurelg commented 2 years ago

Quick low-tech hack until it's fixed:

#!/usr/bin/env python3

import re
from subprocess import run

import psutil

def main():
    """docstring for main"""

    for process in [
        psutil.Process(int(pid))
        for pid in re.findall(
            re.compile(r"[0-9]{3,}"),
            run(["needrestart"], capture_output=True).stdout.decode(),
        )
    ]:
        __import__("pprint").pprint(process)

if __name__ == "__main__":
    main()
djl commented 2 years ago

This annoyed my just enough to look into it. Turns out it's a bug in the Proc::ProcessTable module. A fix was released in August (0.61) so updating to a newer version should fix it.

yochananmarqos commented 2 years ago

@djl I just updated to 0.634 and it's working great, thanks for finding that. I flagged the Arch community package out of date as well.