[SOLVED] Fatal memory error

14 years 1 month ago #126753 by chuckbone
[SOLVED] Fatal memory error was created by chuckbone
I did a search around this forum before posting, and it appears that I am not the only one to encounter this issue. I recently moved to a new server/host and the first time I tried to access the CB Subs plugin in the back end via CB plugin manager, I got a

Fatal error: Out of memory (allocated 24903680) (tried to allocate 19456 bytes) in /home/macros/public_html/components/com_comprofiler/plugin/user/plug_pms_mypmspro/pms.mypmspro.php on line 129

The PMS plugin is not even published. My memory limit at the time was and always has been set at 32M, I upped it to 128M just to see what happened and still got the same error. These memory limits are confirmed in phpinfo and like I said I'm on my own server, so it's not like my memory settings are being overridden somewhere else.

Post edited by: krileon, at: 2010/03/15 20:33

Please Log in to join the conversation.

14 years 1 month ago #126754 by chuckbone
Replied by chuckbone on topic Re:Fatal memory error
Determined that my memory limits were not the problem, a grep search for any php that may be setting a limit turned up:

(it's an image because I can't post this in this thread as text or the server throws a 500 error)

Post edited by: chuckbone, at: 2010/03/14 03:51
Attachments:

Please Log in to join the conversation.

14 years 1 month ago #126755 by chuckbone
Replied by chuckbone on topic Re:Fatal memory error
Here's the image:
Attachments:

Please Log in to join the conversation.

14 years 1 month ago #126756 by chuckbone
Replied by chuckbone on topic Re:Fatal memory error
This leads me to believe that CB is the cause of my memory error, as it appears to be choosing to allocate 24M for some reason. I haven't uninstalled the PMS plugin but it is disabled and I don't need it. This is really frustrating. I'm on my own server so there is no way that my host or my server's memory settings are causing this. It has to be caused in CB.

Now the plot thickens. I tried commenting out sqlite.so and pdo_sqlite.so after reading here that it helped others. When I click on the CB Subs plugin now, it loads a tiny bit of it without any templating (just unformatted links to gateways, plans, etc) and at the bottom of these it displays another memory error:

Fatal error: Out of memory (allocated 25427968) (tried to allocate 41 bytes) in /home/macros/public_html/components/com_comprofiler/plugin/user/plug_cbpaidsubscriptions/cbpaidsubscriptions.class.php on line 0

I'm at my wits end here. Clearly CB is setting its own memory limit and this is causing problems. What should I do?

Thanks for the help!

Please Log in to join the conversation.

14 years 1 month ago #126758 by chuckbone
Replied by chuckbone on topic Re:Fatal memory error
Ok, so I noticed in all four CB files that had instances of memory_limit this code was present:

[code:1]
$memMax = trim( @ini_get( 'memory_limit' ) );
if ( $memMax ) {
$last = strtolower( $memMax{strlen( $memMax ) - 1} );
switch( $last ) {
case 'g':
$memMax *= 1024; //Should be something like 1024*1024*1024;
case 'm':
$memMax *= 1024; //Should be something like 1024*1024;
case 'k':
$memMax *= 1024;
}
if ( $memMax < 16000000 ) {
@ini_set( 'memory_limit', '16M' );
}
if ( $memMax < 32000000 ) {
@ini_set( 'memory_limit', '32M' );
}
if ( $memMax < 48000000 ) {
@ini_set( 'memory_limit', '48M' );
}
}
[/code:1]

For some reason it seems like it wants to round up the memory setting, but it does the math wrong and seems quite obfuscated. I made the replacements above in each of the four files, but I am still getting a memory error when I click on the CB Subs plugin. I'm afraid this may be present in some variation in the CB Subs plugin files, but as they are encoded I haven't a clue.

The memory error I'm getting now: Fatal error: Out of memory (allocated 25427968) (tried to allocate 41 bytes) in /home/macros/public_html/components/com_comprofiler/plugin/user/plug_cbpaidsubscriptions/cbpaidsubscriptions.class.php on line 0

This indicates that my memory is being set at 24M by some script. I've dumped the initial $memtest variable in the script above and it came out as 38M which is my current setting. It's set correctly in php.ini and I usually am allocated that except for when I try to run the CB Subs plugin in the back end.

Maybe this thread belongs in the CB Subs forum, so if it does please move it I just don't want to cross post this.

Please someone in the know help!

Post edited by: chuckbone, at: 2010/03/14 05:27

Post edited by: chuckbone, at: 2010/03/14 05:34

Please Log in to join the conversation.

14 years 1 month ago #126759 by chuckbone
Replied by chuckbone on topic Re:Fatal memory error
Aha!

Apache rlimitMEM settings were mucking things up. I guess I didn't consider this as a possibility but everything now works. This makes sense given that the problems began when I moved hosts.

Still though, I guess I don't understand the purpose of the memory limit settings in CB anyway?

For future searchers: my rlimit settings in httpd.conf were as follows:

RLimitMEM 89478485
RLimitCPU 240

I removed those and it all worked. Be aware these are used to limit the amount of CPU/memory that apache gives child processes. If you do this be sure to set a decent PHP memory limit, as PHP scripts are usually the culprits for hogging memory anyway.

Post edited by: chuckbone, at: 2010/03/14 05:50

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.148 seconds

Facebook Twitter LinkedIn