Forums | Mahara Community
Support
/
Memory problems with Mahara and Joomla
09 October 2013, 19:56
We have installed 1.7.2 of Mahara onto an existing Ubuntu 12.04 server running Joomla.
As long as Mahara is never accessed then the web server works fine. However once we start using Mahara then we start hitting memory problems with Joomla with "Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 523800 bytes) in /var/www/joomla/libraries/joomla/language/language.php on line 174"
Now I have applied all the changes suggested at https://wiki.mahara.org/index.php/System_Administrator's_Guide/Scalability
Increasing the memory_limit from 256M to 512M made no difference. Changing max_input_time from 60 to 180 and max_execution_time from 30 to 180 just delayed the problem for three minutes.
That suggests that something in Mahara is getting stuck, timing out and not freeing memory. As I say if restart apache and never access the Mahara site then everything is fine. It's only when Mahara is accessed that this problem occurs.
Has anyone had this problem, or similar, and can give me some pointers as to what config I need to be tweeking. From my point of view this looks look a failure to clear memory in Mahara.
Thanks in advance
Ian
10 October 2013, 10:59
Hi Ian,
That's a strange one. "Allowed memory size of ___ bytes exhausted" means that the Joomla script is trying to use more memory than the amount in memory_limit in your php.ini. (536870912 bytes = 512 MB). So the problem is not that Mahara is using up too much memory and there's none left for Joomla. The problem is that Joomla is trying to use more memory than a single PHP script is allowed.
Why it's happening only after you start using Mahara, is pretty mystifying. I'm not at all familiar with Joomla, so I can only speculate in general terms. Did you install any additional PHP extensions or Apache modules as part of the Mahara installation? In theory that could have caused Joomla to execute differently, in a way that hits a memory leak. Or is Joomla doing something strange like monitoring all the other running processes on the server, or trying to index Mahara's content?
Cheers,
Aaron
11 October 2013, 6:37
Hi Aaron,
I'm not aware of any changes to the apache config when Mahara was setup. I have only recently updated the PHP memory setting from 256 to 512M since Mahara was active and giving this issue. Before Joomla would work quite nicely and not hit any memory problems with 256M - now once Mahara has been accessed even 512M is not good enough.
We are using specific site-available config files in apache with different subdirectories in /var/www so there shouldn't be any interaction between the two.
I guess a better question to ask here is does Mahara expect to be the only web service running? i.e. does it have a opportunistic view on memory and just uses memory to pre-cache at lot of things upto a percentage of available? And as a side effect we are hitting this issue.
Or could it just be a really nasty timing issue with scripts run on two services trying to claim the same memory pool at the same time.
11 October 2013, 12:50
Hi Ian,
No, Mahara doesn't do anything fancy with cacheing, and it's meant to play well with other scripts. Here at Catalyst IT, we regularly run Mahara sites and other PHP scripts out of the same server without any particular problems. Running Mahara & Moodle on the same server is also a very common use-case we hear about on the forums.
If you have a large Mahara site (above 10,000 users and lots of portfolio content) you can start running into memory issues. Also, importing and exporting to Leap2a can be pretty memory intensive. But all this should result in, is that particular Mahara pageload hitting the memory_limit setting and crashing.
There's also the Mahara cron job, but that too should respect the memory_limit setting in your php.ini. It uses database-side locking to make sure that two instances of the cron job don't try to run the same Mahara cron task simultaneously; and if a cron task crashes, then that same lock ensures that Mahara doesn't try to run that task again for 24 hours. So the cron is pretty memory-safe as well.
Cheers,
Aaron
15 November 2013, 5:51
Same problem here.
Joomla and Mahara are running in differents vhosts in the same machine along with other moodle instances and pages. Joomla works well until a Mahara request is served. After this a bunch of exhausted memory errors are dumped to apache log.
Using Mahara 1.8, Joomla 2.5 in CentOS 5.10 server.
Any ideas?
Thanks :D
Emilio
15 November 2013, 12:28
Interesting, perhaps there's something strange about the Joomla/Mahara interaction. Maybe you could try asking on the Joomla forums?
The fact that Joomla scripts are exhausting the memory limit if they're run at the same time as Mahara suggests maybe there's a memory leak in Joomla, which is triggered when it has to compete for some resource it shares with Mahara (the filesystem? a DB connection?). But that's just a shot in the dark.
Cheers,
Aaron