How can a program run but not be in the process list?
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How can a program run but not be in the process list?
I wrote a program that watches (using inotify) for new images from
remote webcams then makes thumbnails of them. It runs all the time.
Occasionally, so they tell me, it stops making thumbnails. It keeps a
log of every inotification and the program never stops on its own but
the script they use to restart the program looks for the program in
the process list and starts it only if it finds it absent. The only
way this makes sense is if the program continues but its process
either has disappeared from the process list or no longer is
associated with the program. How can this happen?
Don't know about that, but you could probably replace that script with one that forks a copy of the webcam script then waits on the child-pid, reaping it (and then promptly restarting it) if it dies for any reason. Presumably the parent-process never would die. You can also use inittab to do this sort of thing ... just be sure to start the process as nobody or somesuch. (The "init" process basically does nothing but wait around for its children, being of course the "proud papa" of the whole system ...)
I didn't report a problem: I asked a question, to wit: can a program continue to execute after it either no longer has a process or the process list no longer associates the process with the program?
A process is the running instance of a program. It requires a pid to be scheduled.
That would mean that the reports people give me mean that a program can continue to run but no longer be identified (presumably in /proc/$PID) with the program that called it?
No way that I can think of. But anything's possible.
I would be more inclined to doubt the info you are being given, or at least demand incontrovertible proof that all that is alleged is actually what is happening.
Not implying they are lying, possibly just misinterpreting the data.
Yes, I wrote the program. It makes an entry in a log every time inotify informs it of a new webcam photo. That log shows no sign of the program not working: notifications are logged every 10 or 15 or 30 minutes (different cameras have different frequencies) for months straight and no errors are reported. The people on site tell me that a user informs them occasionally that the thumbnail is not a miniature of the current photo, that not only is it not but that it is black (the webcams run all night) at a time that the sun has been up for hours. There's a lag of a second or so, but not hours. They restart with a script I have written that looks for the program running. That program finds the thumbnail-maker for camera in question not in the process list.
I have rewritten the program to store its PID in /var/run/ and the script to look for that file and report about the PID. So I should find out next time it happens.
You might also add another script that runs every minute by cron, picks up that PID from /var/run, shows it from "ps" and also gathers its /proc/PID info. Then if something odd happens, you have some idea of what and when.
Normally a program does not just fall out of the process list. More likely it strangled itself from some bad memory access, and the program name in virtual memory was a victim of this, leading it have some other string for the program name in the "ps" list.
Beyond this thread, you might need to go through debug cycles on the program (which I'm guessing is your intention once you catch it in the misdeed).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.