today I found something strange about the /proc
folder. There is a PID (7825) which I cannot see as a running process via ps
, also I cannot see the process id when I make ls /proc
BUT I can see it with ls /proc/7825
and also can cd into it. Here the outputs:
# ls /proc
...
dr-xr-xr-x 9 xxxxxxx xxxxxxx 0 May 16 20:57 7812
dr-xr-xr-x 9 xxxxxxx xxxxxxx 0 May 16 20:52 7820
dr-xr-xr-x 9 root root 0 May 16 20:52 7836
dr-xr-xr-x 9 root root 0 May 16 20:52 786
dr-xr-xr-x 9 xxxxxxx xxxxxxx 0 May 16 20:57 7923
dr-xr-xr-x 9 xxxxxxx xxxxxxx 0 May 16 20:52 7924
...
ps aux | grep [7]825
[EMPTY RESULT]
ls /proc/7825
attr clear_refs coredump_filter environ fdinfo largest_task make-it-fail mem mountstats oom_adj pagemap root setgroups stat syscall timerslack_ns weight
auxv cmdline cpuset exe gid_map limits map_files mountinfo net oom_score personality schedstat smaps statm task uid_map
cgroup comm cwd fd io loginuid maps mounts ns oom_score_adj projid_map sessionid stack status time_in_state wchan
Why is this PID available for ls /proc/7825
but doesn't show up in the ps
os ls /proc
?
This is quite critical for my program, because I have to check if a certain PID (of the previous run) is still running (check if /proc/[LAST_RUN_PID]/exe
exists). If so, I consider the previous run as "still-running". Today we had the issue, that the file /proc/7825/exe
still exists (for hours) even if there is no program running.
Can somebody elaborate why/how this happens?
If you post this as question, I'll mark it as the solution.
– guenhter May 17 '21 at 08:19