PHP processes maxing CPU 100%

Post your questions about Web Server usage and Apache + PHP + MySQL/SQLite web applications.
hcroij
New here
Posts: 7
Joined: Wed Jul 07, 2010 5:33 pm

Re: PHP processes maxing CPU 100%

Post by hcroij »

you are right.

data gone, but atleast the nas is working again.
So if ur desperate and your skills are as good as mine,
this is a solution.

If ur clever, you first make a backup of the data on an other nas or your pc.
03397
Starting out
Posts: 38
Joined: Sun Jun 05, 2011 2:09 am

Re: PHP processes maxing CPU 100%

Post by 03397 »

schumaku wrote:Data gone - no more open jobs...

Can you please explain why the qnap 419p+ has a php high cpu?
This was niot happening until the newer firmware...

Almost all the time when I i log on I have high cpu

At top conmmand I get
PID USER STATUS RSS PPID %CPU %MEM COMMAND
1642 admin R N 11M 1624 98.2 2.2 php

and at ps ax | grep php

1642 admin 11304 R N /usr/local/apache/bin/php -c /etc/config/php.ini -d m


What does this do and why it takes for ever?
User avatar
schumaku
Guru
Posts: 43579
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: PHP processes maxing CPU 100%

Post by schumaku »

03397 wrote: 1642 admin 11304 R N /usr/local/apache/bin/php -c /etc/config/php.ini -d m
Make the terminal wider please...
03397
Starting out
Posts: 38
Joined: Sun Jun 05, 2011 2:09 am

Re: PHP processes maxing CPU 100%

Post by 03397 »

schumaku wrote:
03397 wrote: 1642 admin 11304 R N /usr/local/apache/bin/php -c /etc/config/php.ini -d m
Make the terminal wider please...
This is the whole think.

PID USER STATUS RSS PPID %CPU %MEM COMMAND
4898 admin R N 11M 4878 95.2 2.2 php

[~] # ps ax | grep php
4898 admin 11672 R N /usr/local/apache/bin/php -c /etc/config/php.ini -d m
6316 admin 484 S grep php
User avatar
schumaku
Guru
Posts: 43579
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: PHP processes maxing CPU 100%

Post by schumaku »

There _is_ more...

Typical suspect is the MSV2/QMobile triggered video conversion
03397
Starting out
Posts: 38
Joined: Sun Jun 05, 2011 2:09 am

Re: PHP processes maxing CPU 100%

Post by 03397 »

schumaku wrote:There _is_ more...

Typical suspect is the MSV2/QMobile triggered video conversion
But why is this running all the time.
If it ran one time why does it repeat itself even no new files were added?

While the php was max 100% I have disabled Multimedia Station and Photo Statio and the PHP 100% process is still there.
03397
Starting out
Posts: 38
Joined: Sun Jun 05, 2011 2:09 am

Re: PHP processes maxing CPU 100%

Post by 03397 »

Here is the whole think

11820 admin R N 10M 11763 76.7 2.0 php


[~] # ps ax | grep 11820
11820 admin 10512 R N /usr/local/apache/bin/php -c /etc/config/php.ini -d memory_limit=128M /mnt/ext/opt/MSV2/api/background_conversion.php /share/Multimedia/Video/Jukebox 1000
14932 admin 576 S grep 11820
[~] #


What is this do and what I can I do to disable it??
User avatar
schumaku
Guru
Posts: 43579
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: PHP processes maxing CPU 100%

Post by schumaku »

It's a part of the (soon legacy) Multimedia Station 2 (MSV2). The conversion processes are triggered from the MSV2 Web UI for example.
03397
Starting out
Posts: 38
Joined: Sun Jun 05, 2011 2:09 am

Re: PHP processes maxing CPU 100%

Post by 03397 »

schumaku wrote:It's a part of the (soon legacy) Multimedia Station 2 (MSV2). The conversion processes are triggered from the MSV2 Web UI for example.

If nothing is changed why is this run every time?
How long does it take to finish?
User avatar
doktornotor
Ask me anything
Posts: 7472
Joined: Tue Apr 24, 2012 5:44 am

Re: PHP processes maxing CPU 100%

Post by doktornotor »

03397 wrote:If nothing is changed why is this run every time?
Ask QNAP. :roll:
I'm gone from this forum till QNAP stop wasting volunteers' time. Get help from QNAP helpdesk instead.
Warning: offensive signature and materials damaging QNAP reputation follow:
QNAP's FW security issues
QNAP's hardware compatibility list madness
QNAP's new logo competition
Dear QNAP, kindly fire your clueless incompetent forum "admin" And while at it, don't forget the webmaster!
User avatar
TTKGoogle.dk
First post
Posts: 1
Joined: Wed Aug 17, 2011 4:39 pm

Re: PHP processes maxing CPU 100%

Post by TTKGoogle.dk »

I just tried to out comment the background_conversion.php content, and after i killed the PID the PHP Process runs through it way more quickly(because it does not convert the content any more).

Now i will wait and see if the error logs explode, or not.

If anyone would like to do the same:
1. Open /mnt/ext/opt/MSV2/api/background_conversion.php in your favorite editor.
2. Insert // in front of alle the lines between <? and ?>
3. kill <php PID>
4. Go to multimedia center, to check that it still works.
5. Check your processes to see that PHP has stopped taking all the CPU power.

BTW: while looking through the background_conversion.php i saw a line with: proc_nice(5); you can edit this to a higher value to give PHP less CPU priority while converting (read more: http://php.net/manual/en/function.proc-nice.php)
lamberbee
First post
Posts: 1
Joined: Sat Jul 06, 2013 12:56 am
Contact:

Re: PHP processes maxing CPU 100%

Post by lamberbee »

I also recently see this behaviour on my new TS-219P II
See that it has to do with video conversion. OK, but I just have a couple (read 5 or 6) video and it's doing that for days and days. Still wondering if this is the cause?

Greetz
Bigglesuk
New here
Posts: 9
Joined: Mon Mar 07, 2011 12:16 am

Re: PHP processes maxing CPU 100%

Post by Bigglesuk »

My QNAP 412 seems to have pretty much constant disk usage (even at night) and looking at processes tab in Resource Monitor shows that PHP proces is at 30-40% and 30megs of memory. I have the latest firmware installed on it, and believe i can no longer downgrade as i remember a warning message saying it would not be possible.

Ive got the latest TwonkeyMedia 7.0.13 QKPG installed, Multimedia Station active (MSV2), and Music Station and Download Station active.

On my android phone and tablet, i do have the Qnap apps, but rarely (once a month perhaps) do i even open them.

What can i do to prevent this high usage of CPU and disks? I dont want them to die because of constant 24/7 access which they seem to have been doing for the last month.

I dont browse to the multimedia files often. I do have quite a few video's on the multimedia share, but my TV isnt a smart TV, and my xbox is off so shouldnt be trying to connect to twonkey.

I'm not familiar with SSH or telnet, and i'm now struggling to work out what to do proceed. Please can anyone assist?
tmanjenkins
First post
Posts: 1
Joined: Mon Sep 23, 2013 6:48 pm

Re: PHP processes maxing CPU 100%

Post by tmanjenkins »

I believe this PHP 100% CPU process named:
/usr/local/apache/bin/php -c /etc/config/php.ini -d memory_limit=128M /mnt/ext/opt/MSV2/api/background_conversion.php

is being triggered by the Multimedia Application's re scan library option. If you have a large media library it might run near 100% for quite some time, I've watched mine in SSH and it's actually about 70-80% most of the time. If your trying to use the NAS for other tasks there might be some slight performance issues but I think media streaming is still alright. I select a time that I won't be using the device like 3am etc.. and this doesn't bother me. I wish you could schedule it to run on specific days of the week. Or possibly scan specific folders only rather than all media folders equally until done. With the GUI you cannot seem to cancel this process but I've found killing this PID didn't affect me.

So it's user select-able and runs on a daily basis. You can disable if you'd like to avoid it but unless it's pegged at 100% for hours it's still probably fine. My temps went up about 2 degrees Celsius ambient during the can likely due to the discs being accessed quite a bit.

Hope this helps someone out.
User avatar
schumaku
Guru
Posts: 43579
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: PHP processes maxing CPU 100%

Post by schumaku »

tmanjenkins wrote:I believe this PHP 100% CPU process named:
/usr/local/apache/bin/php -c /etc/config/php.ini -d memory_limit=128M /mnt/ext/opt/MSV2/api/background_conversion.php

is being triggered by the Multimedia Application's re scan library option.
Nope I'm afraid, this process is Multimedia Station v2 (MSV2) and Qmobile related only, doing user requested file conversions pushed to an API only. Why it's unrelated to the Media Library? There is no /opt/MSV2/ if the clunky Multimedia Station V2 App is not installed :idea:
Post Reply

Return to “Web Server & Applications (Apache + PHP + MySQL / SQLite)”