Yii Framework Forum: Yii App Reaches Memory Limit On Linux Server - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii App Reaches Memory Limit On Linux Server Rate Topic: -----

#1 User is offline   vladotg 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 15-July 11

Posted 14 November 2012 - 06:18 AM

Hello! I have a really strange problem and I dont know how to solve it. My application reaches memory limit from time to time and Internal server error 500 happens. I have limit of 570MB on shared hosting. I tried to debug my application and YiiDebug Toolbar shows that every page is consuming about 10-12MB of memory. I dont really get where is the problem. On my local wamp server, there are no problems.

Can anyone help me? At least tell me where to start looking for memory leaks because I dont see any obvious.

Here is capture of memory resource usage in cPanel:
Posted Image
0

#2 User is offline   luc 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 211
  • Joined: 22-June 10
  • Location:france

Posted 14 November 2012 - 12:28 PM

Hi,
Try to set 'YII_DEBUG' to false (in index.php) or comment the line.
Hey Ho !
Let's go !
0

#3 User is offline   vladotg 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 15-July 11

Posted 14 November 2012 - 01:27 PM

View Postluc, on 14 November 2012 - 12:28 PM, said:

Hi,
Try to set 'YII_DEBUG' to false (in index.php) or comment the line.


I already commented that line :/
0

#4 User is offline   luc 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 211
  • Joined: 22-June 10
  • Location:france

Posted 14 November 2012 - 01:47 PM

hum, that was what I've seen here as a solution for the same kind of problems ...

does this happens on some particular request (<=> some havy sql request) or is it unpredictable ?
Hey Ho !
Let's go !
0

#5 User is offline   vladotg 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 15-July 11

Posted 14 November 2012 - 01:48 PM

View Postluc, on 14 November 2012 - 01:47 PM, said:

hum, that was what I've seen here as a solution for the same kind of problems ...

does this happens on some particular request (<=> some havy sql request) or is it unpredictable ?


It is unpredictable. That's why is strange to me...
0

#6 User is offline   luc 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 211
  • Joined: 22-June 10
  • Location:france

Posted 14 November 2012 - 02:46 PM

well, I'm sorry, but I'm unable to help you more :(
Hey Ho !
Let's go !
0

#7 User is offline   vladotg 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 15-July 11

Posted 14 November 2012 - 06:47 PM

View Postluc, on 14 November 2012 - 02:46 PM, said:

well, I'm sorry, but I'm unable to help you more :(


Thanks anyway. Anyone else?
0

#8 User is offline   vladotg 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 15-July 11

Posted 15 November 2012 - 07:16 PM

I have read somewhere that the problem might be in lot of AR records. I don't really know how much is too much.

On frontpage I have CGridView with 3 pages (DataProvider is from AR). i have 4 more pages, all of them get data from AR. 3 of them have about 20-30 records and one have 50-60 records. Is that lot of AR records?

My site is not really crowded so I don't think that lot of users is a problem. It is a small intranet for one association.
0

#9 User is offline   yugene 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 497
  • Joined: 08-August 09

Posted 16 November 2012 - 11:00 PM

Installation you describe shouldn't cause memory problems AFAK.
Can you provide full error stack?
In my practice this problem was always caused by one reason - error in code that leads to endless operation.
0

#10 User is offline   guaruja 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 68
  • Joined: 10-March 12

Posted 17 November 2012 - 07:18 AM

View Postyugene, on 16 November 2012 - 11:00 PM, said:

In my practice this problem was always caused by one reason - error in code that leads to endless operation.


Totally agree :rolleyes:
0

#11 User is offline   vladotg 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 15-July 11

Posted 17 November 2012 - 08:13 AM

View Postyugene, on 16 November 2012 - 11:00 PM, said:

Installation you describe shouldn't cause memory problems AFAK.
Can you provide full error stack?
In my practice this problem was always caused by one reason - error in code that leads to endless operation.


Hm.. You mean error log from cPanel? The only error that is logged whenever app reaches memory limit is this:

(12)Cannot allocate memory: couldn't create child process: /opt/suphp/sbin/suphp for /home/xxx/public_html/index.php + some referer

I have put a function inside every action in every controller to see how much memory each action uses, and the results are 7MB average.
0

#12 User is offline   yugene 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 497
  • Joined: 08-August 09

Posted 17 November 2012 - 09:08 AM

View Postvladotg, on 17 November 2012 - 08:13 AM, said:

You mean error log from cPanel?

Well, I hoped yii error stack is available.
I googled a bit and found out there're quite a lot of same error messages with some ideas what to do and where to dig. I think it's a good idea to investigate these cases first and to try to catch more information on the error, giving attention to what the error says:
couldn't create child process: /opt/suphp/sbin/suphp

Sorry, that's all I can suggest for now ).


0

#13 User is offline   doltuku 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 18-June 12
  • Location:Indonesia

Posted 18 November 2012 - 01:16 AM

thanks for all the information guys
0

#14 User is offline   KonApaz 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,311
  • Joined: 21-February 11
  • Location:Greece

Posted 18 November 2012 - 05:27 AM

Hi vladotg

1) set debug_mode to false
2) use Yiilite rather run yii on index.php

3) do you use any cache mechanism in yii?
4) Is database on localhost same with database on server (both schema and records)?
5) Did you check any server issues?
Yii is the best php framework in the world!
find our demo Yii extension on www.webkit.gr
Is it post useful? please v++ ;)
0

#15 User is offline   vladotg 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 15-July 11

Posted 18 November 2012 - 05:38 AM

View PostKonApaz, on 18 November 2012 - 05:27 AM, said:

Hi vladotg

1) set debug_mode to false
2) use Yiilite rather run yii on index.php

3) do you use any cache mechanism in yii?
4) Is database on localhost same with database on server (both schema and records)?
5) Did you check any server issues?


1) I already did that.
2) I'll try that. But what are the differences between yiilite and yii?
3) No, i don't use any cache mechanism.
4) Yes, it is the same database.
5) I have checked, the hosting company says that they think the problem is in application.
0

#16 User is offline   KonApaz 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,311
  • Joined: 21-February 11
  • Location:Greece

Posted 18 November 2012 - 05:54 AM

View Postvladotg, on 18 November 2012 - 05:38 AM, said:

1) I already did that.
2) I'll try that. But what are the differences between yiilite and yii?
3) No, i don't use any cache mechanism.
4) Yes, it is the same database.
5) I have checked, the hosting company says that they think the problem is in application.


yiilite is more lighter than yii combined with debug mode=false

Did you check the protected/runtime/application.log for relative errors?
Yii is the best php framework in the world!
find our demo Yii extension on www.webkit.gr
Is it post useful? please v++ ;)
0

#17 User is offline   vladotg 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 15-July 11

Posted 18 November 2012 - 06:43 AM

View PostKonApaz, on 18 November 2012 - 05:54 AM, said:

yiilite is more lighter than yii combined with debug mode=false

Did you check the protected/runtime/application.log for relative errors?


Hm.. I just saw something interesting in application.log. There are some errors that are saying:

[error] [exception.CHttpException.404] exception 'CHttpException' with message 'The system is unable to find the requested action "cache".' in /home/xxx/yii/framework/web/CController.php:484

Can that be related?
0

#18 User is offline   KonApaz 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,311
  • Joined: 21-February 11
  • Location:Greece

Posted 18 November 2012 - 06:49 AM

View Postvladotg, on 18 November 2012 - 06:43 AM, said:

Hm.. I just saw something interesting in application.log. There are some errors that are saying:

[error] [exception.CHttpException.404] exception 'CHttpException' with message 'The system is unable to find the requested action "cache".' in /home/xxx/yii/framework/web/CController.php:484

Can that be related?



check in protected/config/main.php for setting of cache, may be you have set no-existance cache
Yii is the best php framework in the world!
find our demo Yii extension on www.webkit.gr
Is it post useful? please v++ ;)
0

#19 User is offline   vladotg 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 15-July 11

Posted 18 November 2012 - 06:53 AM

View PostKonApaz, on 18 November 2012 - 06:49 AM, said:

check in protected/config/main.php for setting of cache, may be you have set no-existance cache


This is the setting:

'cache'=>array(
'class'=>'CFileCache',
),
0

#20 User is offline   KonApaz 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,311
  • Joined: 21-February 11
  • Location:Greece

Posted 18 November 2012 - 06:57 AM

View Postvladotg, on 18 November 2012 - 06:53 AM, said:

This is the setting:

'cache'=>array(
'class'=>'CFileCache',
),


comment entire cache on main.php to check, delete the application.log end request again, see if application.log trace any other problem
Yii is the best php framework in the world!
find our demo Yii extension on www.webkit.gr
Is it post useful? please v++ ;)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users