Lost Process?
Lost Process?
- Subject: Lost Process?
- From: Spencer Nielsen <email@hidden>
- Date: Thu, 16 Mar 2006 12:54:21 -0800
I have an interesting problem that I am trying to understand.
I have a PreferencePane that uses code based off of Apple's GetPID example (which in turn uses sysctl with CTL_KERN, KERN_PROC and KERN_PROC_ALL) to query the state of currently running processes and searches by name to see if a companion program is currently running. My problem is that right now the results that the sysctl call are not the same results displayed by top and Activity Monitor; most notably that sysctl says that my companion program is currently running, has a PID for it and everything but neither top nor Activity Monitor say that it is.
I have tried to sudo kill PID and nothing happens. sysctl always reports back that the companion process is running. Up until now sysctl would accurately report that my program is not running if it is in fact not running and my PreferencePane would work as intended. Because I have been working on developing the companion program I have been launching and stopping it all over the place, both through the debugger, the finder and otherwise. I had been working on one portion of it for the last few days and have been running the machine for a while and put it to sleep a few times. It was not until I returned to working on the PreferencePane that I noticed that it always said that my companion program was still running even though top said that it was not. I started to debug the PreferencePane to see if it was maybe some weird thing that I missed. I isolated it down to the fact that sysctl is still including a process structure for the companion program in the results when as far as I understand, it shouldn't be.
I have also created a separate test program that simply calls sysctl and looks for the same process. It also reports back that it is running. I suspect that if I reboot my machine the problem will go away or it will easily reproduce (which will then point me towards the bug which is most likely mine). However, I am afraid that if I do reboot that it will in fact go away and I will not be able to reproduce the behavior (because I have no idea what behavior caused it in the first place). Thus my opportunity to hunt this bug might be gone for a while. I don't know much about how the kernel stores process structures but possibilities that I have run through my head are that something went wrong in the bsd process management of the kernal (but then why does "top" not reflect the same results? does top use sysctl or something else like mach calls?). Then again it could also be random cosmic rays or my own bug that I am still overlooking. So before I do actually reboot I wanted to throw it out there and see if anybody more knowledgeable in these things than me could provide any insight.
Thanks! Spencer Nielsen |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden