Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've got a server running apache, and have been seeing occasional apache processes go to 100% and stay there. Today, with two processes at 100%, I turned off external access to the server (to prevent further requests to apache). Five minutes later, no requests are coming in to the server but both processes are still at 100%.

I've run lsof on each process, and they've giving me about 9000 lines of output (that might as well be greek to me). No other processes seem to be behaving strangely or waiting etc.

My database is on a second server. Using mytop shows two MySQL connections active from the apache server, both with a state of "sleep". I killed one of those MySQL threads, and there was no change to either process on the Apache server.

This apache server is one of two behind a simple load balancer. I don't know if that could be related.

How can I confirm that the apache issue is related to what I'm seeing on the database server? And is this likely to be the result of a dodgy SQL call, or something else?

Edit: Found the issue. It was a code problem with Magento. The image resizing function was failing to open an image, because the extension was incorrect (it was a BMP with a jpg extension). The error handler for this was invoking the resize again, et voila - a loop. Found this by doing strace on the misbehaving apache process.

share|improve this question
1  
Good question/solution. I asked myself what I would have done given the situation and I had no idea where I would start with something like that. It's good to see someone else's train of thought and process. –  Safado Oct 28 '11 at 13:48
    
I suggest that you move the solution text out of the question into your own answer, accept your answer, and mark this comment as obsolete. –  Darthenius Dec 28 '11 at 23:20
add comment

2 Answers

Perhaps your Apache is out of date and vulnerable to the recent range request vulnerability, and someone or something is now exploiting it?

share|improve this answer
    
Thanks for the quick reply! I updated and upgraded, and added one of the recommended prevention measures for the range vulnerability, restarted everything and re-enabled traffic, and the same thing happened again almost immediately - Apache process went to 100% (and is still there, with traffic off again). –  Dave Child Oct 28 '11 at 9:25
add comment
up vote 0 down vote accepted

Found the issue. It was a code problem with Magento. The image resizing function was failing to open an image, because the extension was incorrect (it was a BMP with a jpg extension). The error handler for this was invoking the resize again, et voila - a loop. Found this by doing strace on the misbehaving apache process.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.