Re: Daemon taking 100% cpu
Re: Daemon taking 100% cpu
- Subject: Re: Daemon taking 100% cpu
- From: "Quinn \"The Eskimo!\"" <email@hidden>
- Date: Fri, 17 May 2013 16:59:50 +0100
On 17 May 2013, at 16:00, Arjun SM <email@hidden> wrote:
> Also I wanted to understand if calling SCDynamicStoreCopyConsoleUser() in my daemon has caused a memory access exception (SIGSEGV or SIGBUS) ?
Almost certainly because you've corrupted the heap. You've crashed in a call to free(). That can happen in one of two ways:
o someone is using free() incorrectly (double freeing a block, freeing a block that was never malloc'd, and so on)
o someone has corrupted the heap (by block over- or under-run, by accessing a block after it's been freed, by accessing a block that was never malloc'd, and so on)
It's unlikely that SCDynamicStoreCopyConsoleUser is the root cause of this problem. Given the specifics of the backtrace, it's most likely caused by your app over-releasing a CF- or NS-style object.
> I probably would not use this function anymore and look for some other ways of knowing if a user has logged in.
Yeah, I didn't even consider the big picture. Tracking the console using like this is not a good idea. In most cases the best approach is to run a per-user launchd agent and have it check in with your daemon. This lets you track logins and logouts, and gives you a way to interact with a specific session.
Share and Enjoy
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden