Problem with Infinite Loop

Receiving a 502 error on 3 of my pages that use Beaver Builder. Spent an hour with the WP Engine team trying to troubleshoot the issue with the 3 pages.

Solved the 502 gateway when we pushed to staging (where the 502 still occurred) but then turned off Beaver Builder.

All 3 pages were then loading fine (no 502) but obviously without any Beaver Builder styling.

WP Engine has said this:

"When I look in the server logs, I see that there’s an infinite loop from the following files:
Infinite loop trying to load:
wp-content/plugins/bb-plugin/modules/rich-text/includes/frontend.php
then
wp-content/plugins/bb-plugin/includes/row.php
then
wp-content/plugins/bb-plugin/includes/column-group.php
then

/wp-content/plugins/bb-plugin/includes/module.php

It repeats over and over until our kill script kills the process."

What can be done to solve this?

Hi Dylan,

Thanks for posting. We aren’t doing anything in wp-content/plugins/bb-plugin/modules/rich-text/includes/frontend.php other than echoing the text editor content, so I’m thinking that maybe a piece of content is causing the hiccup.

Is there anything out of the ordinary in a text editor module on those pages (maybe a custom script)?

Have you built any other BB pages on this site that aren’t having this issue?

Send me temporary admin and FTP access and I’ll look into this today.

Thanks,
Justin

Hi Justin,

Looked like an old piece of script was on the pages. I have since removed the script.

In order to do that I had to move from Beaver Builder editor to the text editor.

I am now having problems moving the content back into Beaver Builder. When I click Beaver Builder (to shift back to the front-end editing) I get the 502 gateway.

Beaver Builder has admin access to our site still.

Hi Dylan,

Thanks for the additional info. Any edits made in the WordPress text editor don’t get applied to the Beaver Builder content. So that script is still likely in there.

I don’t typically save login info for customer sites. Can you resend that? I’ll get in there and get that script removed.

Thanks,
Justin

[Content Hidden]

[Content Hidden]

Thanks, Dylan. I was able to remove these shortcodes from those pages and they appear to be working now.

[jwl-utmce-widget id=1553]
[jwl-utmce-widget id=1982]

Can you tell me what plugin these shortcodes are from and what they are supposed to do? Maybe I can figure out where the hangup is.

Thanks,
Justin

WP Edit Pro is what those shortcodes came from.

I believe it was the javascript within the shortcodes that caused the problem and that was from a third party affiliate software called OSI Affiliate by Omnistar: http://www.osiaffiliate.com/.

Hi Dylan,

I don’t think it was JavaScript as that wouldn’t cause the server to become responsive (JavaScript runs in the browser). I believe it’s something to do with how the shortcodes are being parsed with PHP. If you can send me some steps to recreate one of those shortcodes on my end, I can see if there is anything we can do.

Thanks!
Justin

[Content Hidden]

[Content Hidden]

Hi Dylan,

Thanks for the additional info. I did some testing on WP Edit Pro and it looks like the shortcode is the issue. This is part of a deeper issue that we’ve been battling and trying to get right from the beginning.

The issue is with shortcodes such as theirs that call apply_filters( ‘the_content’, $content ); within their shortcode function. There’s nothing wrong with doing that, but it does present some unique complexities for us as the builder’s content has to be rendered using the_content filter as well.

We thought we had it right, but it turns out our solution broke an obscure WordPress feature that allows you to escape and display shortcodes within your content using double brackets like so…

[[my-shortcode]]

We fixed that and that fix appears to be what is causing the infinite loop with shortcodes that filter the content again.

Additionally, a second the_content filter makes it so some of the later filters that should run on our content don’t run. That is because the second filter overrides the first.

It’s a complex problem with a handful of different things going on that we have to support. I have a fix in the works that should support all of the scenarios we are aware of and will patch your site when that’s ready tomorrow.

Thanks,
Justin

Hi Dylan,

I just patched your site with a fix for this issue. I spent a significant amount of time testing a handful of solutions and believe we now have one that accounts for modules, widgets and shortcodes that apply additional filters (amongst other things). Give it a shot and let me know if anything else arises.

Thanks for your help and patience in figuring this out!

Justin

I just realized what your use case for “Snidgets” is as well. Once we implement “reusable” content, you shouldn’t need those :slight_smile:

Our plan is to get that out this summer. Stay tuned!

Justin

Will “reusable” content allow for a change once in one spot, change everywhere that content is located feature?

Snidgets are awesome for us because we will have multiple groups of pages targeted with a slight difference but has 80% of the same content. We love having the ability to make a change and have that push to every page right away.

Hi Dylan,

Will “reusable” content allow for a change once in one spot, change everywhere that content is located feature?

Yes indeed! We hope to start working on that feature very soon. Stay tuned!

Did the patch help with your issue?

Justin