MEC shortcode out-of-memory errors

Hi,

I’m experiencing problems with adding MEC shortcode, out-of-memory errors that cause Cornerstone to hang and other issues. This has been mentioned on another thread:

Is MEC particularly resource-heavy? Any insights on this? The site is now live, and I can point you to a page which demos the error (in secure note).

Many thanks!

Hello Michael,

Thanks for writing in! Please make sure that you are up to date. Our latest versions are:

  • X theme 7.2.3
  • Cornerstone 4.2.3
  • PHP version 7.2 or higher
  • WordPress core 5.3.2 or higher
  • MEC 5.4.6

This latest release contains fixes for several issues so be sure to check out the changelog (http://theme.co/changelog/).

After doing the updates, always remember to clear all caches (if you are using WP Rocket, WP SuperCache or W3 Total Cache) when updating so that the code from the latest release is always in use. This will help you to avoid any potential errors.

Out of memory error occur when you have several plugins active. You can resolve this by increasing your PHP memory limit to at least 512MB. ​We recommend that you increase your memory allocated to PHP. To increase it, please edit your wp-config.php file and insert these lines:

define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );

You can add it before the line
/*That's all, stop editing! Happy Blogging. */

We would love to know if this has worked for you. Thank you.

Hi @ruenel,

Everything is at the latest version, and memory was already set as specified.

I have now cloned my site to a new domain and host, to check that this is not a hosting problem. You can visit the new site with the credentials in the secure note.

Please go to the test page, add a new section, and try adding the shortcode [MEC id=“368”] into a content area. You will see that Cornerstone either hangs or fails to save. This is the same on two different hosts, Siteground and Dreamhost.

MEC 5.4.6 shortcode constantly invokes out-of-memory errors that cause the site to malfunction in various ways. This is quite a serious issue that is causing numerous errors on our live site.

Hello Michael,

Thanks for the updates. I have logged in and I found out that you have 41 active plugins with only 256MB of PHP memory limit. MEC keeps using your PHP memory and most of the time returns an error because 256MB is not quite enough with all your active plugins and MEC having to use the most of it by going back and forth of the database in displaying the events. ​We highly recommend that you increase your PHP memory limit from 256MB to 512MB instead. This should be enough and will resolve MEC from getting some error.

Hope this helps. Kindly let us know.

Hi @ruenel,

I’m not sure where you got the info about the memory limit on my test site manifestnirvana.com, but this is set at the maximum recommended for Siteground 768M. Please see the attached.

Even when set at this value, Cornerstone fails to save when using MEC shortcode. Did you test this? It also fails to render the contents of the shortcode, even if it appears to be saved on the page.

Screenshot 2020-06-01 at 07.42.33

Please check my test page and try adding the shortcode [MEC id=“368”] into a page section. As I said, we have extensively tested this on two different hosts and with memory limits maxed out.

Hi Michael,

I added a page called Raw Test and used the standard WordPress editor to add the shortcode and it worked.
I added another one called Cornerstone Test and it shows the error.

I then checked the same case scenario on my local installation and another server and there is no problem adding the MEC shortcode. This whos that there is a problem with your environment.

I tried to debug and see what is the cause and it shows the error 500 for the endpoint that should be a PHP error indication and might be caused by some sort of plugin or cache conflict other than the memory limit, which I see you already added well enough amount for.

I suggest that you create staging version of your website using this guide and do the plugin conflict test below:

  1. Test for a plugin conflict. You can do this by deactivating all third-party plugins, and see if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.

  2. Remove custom CSS and Javascript from the theme options and change the theme from Child Theme to Parent Theme and see if the problem persists.

  3. If you’re using a CDN, please clear the CDN’s cache and disable optimization services.

Thank you.

Hi Christopher,

This is already a staging site, the live site is on a completely different host, and yet the issue is exactly the same on both.

However, I have now created a second staging site, the URL and credentials are in the secure note. You will see that I have disabled all plugins and reverted to parent theme. I am not using a CDN.

Check out my test page to see that the issue is still there, despite all these troubleshooting steps. I even deactivated, deleted and re-installed MEC.

Please bear in mind that this is happening on two completely distinct hosting environments, Dreamhost and Siteground.

I duplicated your test on the new staging domain using a page called Cornerstone Test. Issue persists in this new page with parent theme, all plugins disabled, and memory maxed out.

Hey Michael,

Since this is not a plugin conflict, this is likely a server configuration conflict. Try contacting your web host to increase the following server config to the specified value.

max_input_time	900
max_input_vars	10000
output_buffering	4096

Also, try downgrading PHP to 7.0 or 7.2.

If those don’t help, please give us FTP access so we can look at the error logs.

Thanks.

Hi @christian,

Precisely the same issue on two completely different servers? I think it is highly unlikely that the exact same problem of configuration would happen on both Dreamhost and Siteground, completely independently of each other.

Siteground’s support is top notch, and they have done a ton of troubleshooting on this today, including downgrading to earlier versions of PHP. Nothing helps. We have literally taken every possible kind of step on this.

Don’t you think this points to the plugin as the probable cause now? In the circumstances, wouldn’t that be the most likely explanation?

Hi Michael,

I should disagree as I have the MEC plugin installed and frankly more than hundreds of people and they use the plugin with no problem. I tested with my shortcode and it worked with no problem on my installation:

Now, that might be a server problem and also might be a database or the combination, the fact that you moved this from server to server I’m now inclined more on the database.

Would you please kindly send us the FTP information? Maybe we can find a clue there.

Thank you for your understanding.

Hi @christopher,

FTP credentials in secure note. Meanwhile I have had our developer do some debugging on this.

Even though all plugins other than MEC and Cornerstone are disabled, the site is making high memory requests - these requests exceed the maximum 768M provided by Siteground.

We could not definitively determine the source of the requests, but the issue is definitely memory, and we suspect MEC queries to be the source. Can you please tell me what the memory limit of your testing environment is, as this could be the reason you are not experiencing the same issue.

Many thanks!

On another note, in response to this, there are at least two other threads with people describing performance issues with MEC shortcodes. This one remains unresolved:

Hi Michael,

Thank you very much for the FTP information. We are going to check and investigate the issue. Meanwhile, I want you to ask you if it is possible to test the new version of the MEC plugin that is just released.

We did not test the compatibility with the theme yet, but I wonder if it can make a difference in your case.

  • Kindly install and activate this plugin.
  • Then, please download the MEC 5.5.0 installable zip file and install it on your WordPress installation.
  • The link of the file is added in the secure note.

Thank you very much, rest assured that we are committed to getting to the bottom of the problem.

Hi @christopher,

Thanks for the suggested solution and the link to the new version of MEC.

I installed it on one of my staging domains (manifestnirvana.com). Unfortunately the issue persists in version 5.5.0 – I see that @carlomue had the same outcome in the other thread.

I have left version 5.4.6 installed on the other staging domain so that you can continue to test without introducing another variable.

1 Like

Hi Michael,

Thank you for testing that for us. We are going to continue the investigation to see what is the cause of the problem.

Please kindly keep FTP connection and User/Pass valid till our technical support staff take a look into the matter.

If there is a conflict issue most probably this will be reported to our issue tracker and then our development team will delve into details and if there is a solution it will be available as part of the Theme/Cornerstone new release.

At this point of time, we suggest that you use the standard WordPress editor to add the MEC shortcode.

Thank you for your understanding and cooperation.

Hi @christopher

Thanks – for testing purposes I have indeed left FTP access available, and the staging site in its current condition.

Has any progress been made in diagnosing what is causing this? It seems to be a specific interaction between MEC and Cornerstone. Has the plugin developer been contacted?

Many thanks again for your help, really hoping this can be resolved soon.

Hi,

Is there any progress on this issue? After seeing the issue, a typical error in php_errorlog looks like this:

[06-Jun-2020 15:11:42 UTC] PHP Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 135168 bytes) in /home/customer/www/soulhome.one/public_html/wp-includes/wp-db.php on line 1990

Many thanks.

Hey Michael,

We’re sorry but there’s no news on this yet. Please kindly wait for updates.

Thanks.

Hi @christian, @christopher,

I see that two updates to MEC have recently been released, 5.6.0 and 5.6.1. Do you have any information about whether these versions have addressed the issue?

Or are your investigations focusing more on the specific interaction between Cornerstone and the MEC shortcode, as this does seem to be one potential reason for the out-of-memory errors?

Many thanks again for your help.

Hey Michael,

Regretfully, we don’t have news as to what specifically is being investigated. But, as soon as MEC updates are available, I’d recommend you try updating to see if it will fix the issue.

Thanks.