Apache using 100% CPU, once again
- by CBenni
Recently, apache2 started using 100% of CPU power:
top gives me
From other, similar threads, I took the tip to use mod_status. Aside from HUGE amounts of NULL requests, it gives:
CPU Usage: u2.16 s1.32 cu0 cs0 - .0835% CPU load
1.2 requests/sec - 17.6 kB/second - 14.6 kB/request
8 requests currently being processed, 42 idle workers
The access and error logs do not show anything surprising or intriguing at all.
Note the .8% CPU usage. Another tip was to use strace:
root@server:~# strace -p 1956
Process 1956 attached - interrupt to quit
restart_syscall(<... resuming interrupted call ...>
And remains like this for at least half an hour, without producing any additional output.
Restarting apache fixed the problem for less than a second
The server runs a few custom python scripts aswell as a django-powered website on apache2 (up-to-date), but even turning the scripts off (or not having them active in the first place) did not change anything.
After I stopped apache and powered my server off, powered it on a few minutes afterwards and restarted all my services, the CPU usage remained low for several hours, just in order to pop up again randomly (?)
The DigitalOcean CPU stats on my server are:
You can see how the CPU usage was super high for almost half a day until I restarted the bot - just to remain stable for several hours and then pop up again.
I am completely at a loss of words and don't know what I could do to find out what piece of my code is giving me these problems or if apache itself is the cause...
Therefore I would greatly appreciate any hints to the questions: What else can I try to do? Which things might I not have checked? Is this definitely in my own code? How do you find what part of python code crashes an app via a infinite loop or similar?