Page 1 of 1
High CPU usage after waking up [latest svn]
Posted: Sun Sep 09, 2007 1:21 am
by excomax
Hi,
I'm using a new svn version of Adium nearly everyday. But since quite some time (I think three or four days) everytime I wake up my Mac from sleep Adium uses up to 150% CPU power and doesn't stop with it until I quit it. It doesn't matter if compiled using Development oder Deployment. I would go back to the actual 1.1.2 but I love the message counter in the menubar so I don't want to miss it.
This bug is reproducable on my Macbook Core Duo 2.0 GHz with all the latest updates from Apple everytime after waking up from sleep. So I think it has something to to with the way Adium is reacting when the OS goes to sleep what results in this behaviour on waking up. This is just a guess since I'm not a programmer. But to me this looks logical. Correct me if I'm wrong.

Re: High CPU usage after waking up [latest svn]
Posted: Sun Sep 09, 2007 1:46 am
by zac
Check out
http://trac.adiumx.com/wiki/Sampling
You could also apply the following patch on branches/adium-1.1 if you don't want to deal with the instability that trunk is going to get soon:
http://trac.adiumx.com/changeset?format ... d_path=%2F
Posted: Wed Sep 12, 2007 5:12 pm
by excomax
Okay, I know you don't prefer getting code samples here. But I'm too lazy at the moment to register at the trac. Sorry for that. Next time I'll be more friendly.

Here's what the sample looks like after waking up which still causes Adium having high CPU usage.
Code: Select all
Analysis of sampling pid 12085 every 10.000000 milliseconds
Call graph:
298 Thread_0f07
298 start
298 _start
298 main
298 NSApplicationMain
298 -[NSApplication run]
298 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
298 _DPSNextEvent
298 BlockUntilNextEventMatchingListInMode
298 ReceiveNextEventCommon
298 RunCurrentEventLoopInMode
298 CFRunLoopRunInMode
298 CFRunLoopRunSpecific
298 mach_msg_trap
298 mach_msg_trap
298 Thread_1003
298 _pthread_body
298 CAPThread::Entry(CAPThread*)
298 HALRunLoop::OwnThread(void*)
298 CFRunLoopRunInMode
298 CFRunLoopRunSpecific
298 mach_msg_trap
298 mach_msg_trap
298 Thread_1103
298 _pthread_body
298 CMMConvTask(void*)
298 pthreadSemaphoreWait(t_pthreadSemaphore*)
298 semaphore_wait_signal_trap
298 semaphore_wait_signal_trap
298 Thread_1203
298 _pthread_body
298 fe_fragment_thread
298 semaphore_wait_signal_trap
298 semaphore_wait_signal_trap
298 Thread_1303
298 _pthread_body
298 forkThreadForFunction
298 -[AWBonjourAccount prepareBonjourThread]
298 CFRunLoopRun
295 CFRunLoopRunSpecific
180 __CFSocketPerformV0
123 __CFSocketDoCallback
122 ProcessSockData
108 printf
108 vfprintf_l
105 __vfprintf
100 __sfvwrite
95 __fflush
95 write
95 write
2 __sfvwrite
1 __memcpy
1 __memcpy
1 _swrite
1 _swrite
1 memchr
1 memchr
5 __vfprintf
1 flockfile
1 flockfile
1 funlockfile
1 __spin_lock
1 __spin_lock
1 vfprintf_l
14 DNSServiceProcessResult
14 recvfrom
14 recvfrom
1 __CFSocketDoCallback
57 __CFSocketEnableCallBacks
54 sendto
54 sendto
2 __CFSocketEnableCallBacks
1 __i686.get_pc_thunk.bx
1 __i686.get_pc_thunk.bx
110 mach_msg_trap
110 mach_msg_trap
3 CFSetApplyFunction
2 __CFRunLoopCollectSources0
1 CFGetTypeID
1 CFGetTypeID
1 __CFRunLoopCollectSources0
1 CFSetApplyFunction
1 CFRunLoopRunSpecific
1 mach_absolute_time
1 __nanotime
1 __nanotime
1 0xa0815050
1 0xa0815050
1 __spin_lock
1 __spin_lock
1 spin_lock
1 spin_lock
298 Thread_1403
298 _pthread_body
178 select
178 select
120 __CFSocketManager
94 CFRunLoopWakeUp
94 __CFSendTrivialMachMessage
91 mach_msg_trap
91 mach_msg_trap
3 mach_msg_destroy
3 mach_port_deallocate
3 mach_msg_trap
3 mach_msg_trap
12 recvfrom
12 recvfrom
5 CFArrayAppendValue
3 _CFArrayReplaceValues
2 _CFArrayReplaceValues
1 malloc_zone_malloc
1 szone_malloc
1 szone_malloc
2 malloc_zone_malloc
2 malloc_zone_malloc
2 CFArrayGetValueAtIndex
2 CFArrayGetValueAtIndex
2 CFArrayRemoveAllValues
2 __CFArrayReleaseValues
2 szone_free
2 szone_free
2 __CFSocketManager
2 __i686.get_pc_thunk.bx
2 __i686.get_pc_thunk.bx
1 CFDataGetLength
1 CFDataGetLength
298 Thread_1503
298 _pthread_body
298 forkThreadForFunction
298 +[NSURLConnection(NSURLConnectionInternal) _resourceLoadLoop:]
298 CFRunLoopRunInMode
298 CFRunLoopRunSpecific
298 mach_msg_trap
298 mach_msg_trap
298 Thread_1603
298 _pthread_body
298 forkThreadForFunction
298 +[NSURLCache _diskCacheSyncLoop:]
298 CFRunLoopRunInMode
298 CFRunLoopRunSpecific
298 mach_msg_trap
298 mach_msg_trap
298 Thread_1703
298 _pthread_body
298 accept
298 accept
Total number in stack (recursive counted multiple, when >=5):
8 _pthread_body
7 mach_msg_trap
5 CFRunLoopRunSpecific
Sort by top of stack, same collapsed (when >= 5):
mach_msg_trap 1396
semaphore_wait_signal_trap 596
accept 298
select 178
write 95
sendto 54
recvfrom 26
__vfprintf 5
Sample analysis of process 12085 written to file /dev/stdout
Sampling process 12085 each 10 msecs 300 times
Posted: Thu Sep 13, 2007 11:20 am
by excomax
Okay... Here's another thing I just realized. Seems to have nothing to do with the sleep mode. It must have to do something with reconnecting. I tried it (reproducable) this way: Login to all accounts (ICQ, AIM, Y!, MSN, Google Talk, Bonjour) then disconnect from internet (unplug the ethernet cable). Then plug the cable back in. After (or while) all accounts log on again the CPU usage raises up to 175% and just quitting Adium stops the fan from spinning like crazy.
Maybe this helps a bit more and hopefully you can reproduce it.
Posted: Fri Sep 14, 2007 6:30 pm
by excomax
And once again me. Sorry guys! But after some further investigation I think this problem has something to do with the way Adium tries to reconnect after the connection got lost.
I opened my Activity Monitor and unplugged my ethernet cable. As soon as I do that the CPU usage raises. It suddenly stops when I switch into offline status on all accounts. When I plug the cable back in and reconnect after that, Adium just connects as expected. I Hope this is helpful in any way.
The used build was 1.2svn r20979 built with Xcode configuration Development. I'm running Adium on a MacBook Core Duo 2.0 GHz with Mac OS X 10.4.10 and all actual updates (Software Update doesn't show anything new) and I have installed Safari 3.0.3 beta. But the problem was also present with the latest Safari 2.
Something other important to know?
Posted: Fri Sep 14, 2007 9:36 pm
by zac
298 Thread_1303
298 _pthread_body
298 forkThreadForFunction
298 -[AWBonjourAccount prepareBonjourThread]
298 CFRunLoopRun
295 CFRunLoopRunSpecific
180 __CFSocketPerformV0
123 __CFSocketDoCallback
122 ProcessSockData
108 printf
This looks like a symptom of
http://trac.adiumx.com/ticket/7887 -- if you `svn up` it'll probably handle it nicer (it won't be printing the same lines over and over and over), but it's still broken on network availability loss. Also check your console.log in /Library/Logs/Console -- it's probably
very big.
Posted: Sat Sep 15, 2007 9:38 am
by excomax
So it's just Bonjour specific? By disabling the (never used) Bonjour account all should be fine?
Posted: Sat Sep 15, 2007 4:50 pm
by zac
excomax wrote:So it's just Bonjour specific? By disabling the (never used) Bonjour account all should be fine?
Yes. At least until it is fixed.
Posted: Sat Sep 15, 2007 6:48 pm
by excomax
Yeah, tried this immediatly after my post and it works well since then. No more spinning fan on waking up.
