LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-01-2012, 09:46 PM   #1
jerkyfanatic
LQ Newbie
 
Registered: Sep 2012
Posts: 2

Rep: Reputation: Disabled
Hundred of Processes Eating up CPU?


I'm not sure how to diagnose this problem and was hoping someone could point me in the right direction.

I have a website in code igniter that has hundreds of processes running and is tanking my cpu usage. If I restart mysql all the processes die and then CPU goes back to 2% usage, wait 3 days and it's back to 70%+ usage.

In htop I see hundreds of processes like this:
7377 username 15 0 98064 11604 5920 S 0.0 0.3 1:02.78 /usr/bin/php /home/username/public_html/index.php

All referencing the same file and same username.

pstack on any of them gives me the same thing:

#0 0x00000034d5ec5de0 in __read_nocancel () from /lib64/libc.so.6
#1 0x00000034daa86ee5 in vio_read_buff () from /usr/lib64/libmysqlclient.so.16
#2 0x00000034daa88129 in my_real_read () from /usr/lib64/libmysqlclient.so.16
#3 0x00000034daa88515 in my_net_read () from /usr/lib64/libmysqlclient.so.16
#4 0x00000034daa82152 in cli_safe_read () from /usr/lib64/libmysqlclient.so.16
#5 0x00000034daa83019 in cli_read_query_result () from /usr/lib64/libmysqlclient.so.16
#6 0x00000034daa818be in mysql_real_query () from /usr/lib64/libmysqlclient.so.16
#7 0x00000000005946f1 in php_mysql_do_query_general ()
#8 0x0000000000594b38 in php_mysql_do_query ()
#9 0x0000000000732709 in zend_do_fcall_common_helper_SPEC ()
#10 0x000000000073185e in execute ()
#11 0x00000000007321f8 in zend_do_fcall_common_helper_SPEC ()
#12 0x000000000073185e in execute ()
#13 0x000000000070044d in zend_call_function ()
#14 0x000000000064c3e7 in zif_call_user_func_array ()
#15 0x0000000000732709 in zend_do_fcall_common_helper_SPEC ()
#16 0x000000000073185e in execute ()
#17 0x000000000074fd42 in ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER ()
#18 0x000000000073185e in execute ()
#19 0x000000000070af69 in zend_execute_scripts ()
#20 0x00000000006b7b78 in php_execute_script ()
#21 0x000000000079476f in main ()

I'm running WHM / CPanel and I tried looking at the apache logs, but I don't see anything significant.

grep 'username' error_log | less

The site is running code igniter and there's no special setup or anything, and it's not showing any PHP errors.

Outputs nothing new in over months. What would be the next steps in troubleshooting something like this?
 
Old 09-02-2012, 02:58 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,341

Rep: Reputation: Disabled
I may be wrong, but it looks like PHP is being invoked through CGI, which means that each HTTP request spawns a new instance of PHP. Having Apache use mod_php would be far less resource-intensive.

Make sure httpd.conf contains a LoadModule directive for php5_module (commonly implemented by including a separate file, "mod_php.conf", containing the LoadModule command and several other PHP-related settings).
 
Old 09-02-2012, 09:04 PM   #3
jerkyfanatic
LQ Newbie
 
Registered: Sep 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
I see what you're saying, but I believe the problem is not so much that it spawns a different instance of PHP, but that the instance of PHP never dies on its own.

To be more specific, what I'd like to know is why it's getting stuck and hanging? Since I can't find where PHP is throwing any errors, what am I missing to further debug?
 
Old 09-03-2012, 04:28 AM   #4
Celyr
Member
 
Registered: Mar 2012
Location: Italy
Distribution: Slackware+Debian
Posts: 321

Rep: Reputation: 81
Well, as the bt tells it gets stuck in a read operation of a mysql query.
Now this may happen but there also should be a timeout for this kind of operations.
Maybe you should have a look at the code or just low down your user resources so he will fix his code.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
httpd processes are eating all my memory... butlerm1977 Linux - General 4 05-16-2012 12:42 PM
kacpid eating cpu 99% cpu time! tjclancy Linux - Software 13 09-19-2011 03:08 PM
LXer: How to find which processes are eating memory in Linux LXer Syndicated Linux News 1 12-29-2010 02:58 AM
[SOLVED] How to show the top processes eating RAM in human readable? quanta Programming 8 08-15-2010 08:56 AM
XFS is eating my CPU xKintaro Debian 0 09-27-2005 09:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration