Home › Toolset Professional Support › [Resolved] Toolset Blocks code causing infinite loop and breaking site
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | - |
- | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | - |
Supporter timezone: Asia/Hong_Kong (GMT+08:00)
Tagged: Toolset Blocks
This topic contains 16 replies, has 3 voices.
Last updated by Luo Yang 3 years, 7 months ago.
Assisted by: Luo Yang.
I am trying to:
We just launched an updated version of hidden link this week and have run into some major problems that are causing the site to crash browsers on mobile and tablet. Working with Mediavine, who is our ad serving company, they've traced a potential issue back to Toolset Blocks.
I am going to paste the latest email from them asking some questions related to Toolset Blocks code, it looks like it's making a call to jQuery 3.5.1 which is causing infinite loops. Underneath my email from Mediavine I am going to paste the two messages I sent them yesterday identifying the issue and how it's breaking our site.
Hi Mark,
Thanks so much for reaching out about this. This is definitely strange and I can't say we've seen this behavior in the past, but it looks like it's related to the Toolset Blocks plugin. When I block the Toolset Blocks plugin scripts, the Maximum call stack size exceeded errors go away and everything loads normally.
This error can appear when a script uses an infinite loop. Looking more closely at the Toolset Blocks code, it looks like it's making a call to jQuery 3.5.1, which might somehow be causing an infinite loop that's bogging down the browser.
(Images attached)
Since we aren't sure of what the variable names are referring to, it's a bit difficult to diagnose exactly what's happening here, but the above jQuery appears to be what's causing this Maximum call stack size exceeded error.
We would recommend reaching out the the Toolset Blocks plugin support team to see if they've had other reports of this and if they could look into this specific console error. If they have any questions or there's anything at all we can do to help on our end of things, please let us know and we'll be more than happy to assist 🙂
Thanks again,
Rachel Johnson
Senior Support Engineer | Mediavine
publishers@mediavine.com
hidden link
Earlier Email to Mediavine
Hi Support,
I wanted to follow up on my email from earlier today. That email went directly to John, who's been helping to get ads set up on hidden link. The best we can currently tell users are unable to access more than the first third of a page on our content on mobile and tablet before their browser crashes.
I've traced the error to Mediavine scripts.
Here is a screenshot (attached) of the errors that are coming up when I try and load a page in an incognito browser using developer tools. It looks like something isn't loading from Mediavine and then continues to break. I'm not sure how info is shared on the Mediavine side of things, so I'm pasting the last email I sent to John describing the error. I'm also not sure what hours folks work over there, so I'd appreciate an email that lets me know if /when anyone is working on this, even if they haven't found a solution.
This looks like a major issue that is completely derailing the launch of our updated site and new theme. Let me know what we can do to get this working.
~ Mark
Earlier email that went directly to John.
Hi John,
I think the latest changes to the ad scripts introduced a bug into the script on mobile. Both my testers and myself have been running into Major Problems where the site completely fails on mobile.
I've tested this in both safari and Chrome (regular and incognito browsers).
What's happening is I open the home page and either choose content from there or search for something and then open it. The top part of the content opens fine, as I scroll down to where the first ad would appear the page freezes up and then usually reloads itself. Once it's reloaded, I'm able to scroll down to where the first ad would be than the whole browsers quits on me and says there was an error.
This wasn't happening earlier in the day and was not happening at all on our test site.
I tried clearing all of our caches - site, hosting, and clourflare and it still happened.
I turned the header carousel option in grow.me to always on, it had been set to come on based on a users scroll, cleared everything out. Still happened.
Turned off the header carousel and the grow.me search integration cleared everything out, and it is still happening.
It does not appear to be happening in the same way on desktop. Although, I've never seen Mediavine ads load as slow as they have today. Watching stuff load it sure looks like something is getting in the way of everything loading cleanly. I've also been getting lots of error messages in Lightroom about Mediavine scripts holding up the page loading as I've been trying to optimize everything, which is new.
I would appreciate any help you can provide figuring out what's going. Also, if there are any tools on your end that can help identify the issue, please let me know.
~ Mark
Link to a page where the issue can be seen:
Can be seen on any post on Umami.site using developer tools in chrome. On mobile the error has crashed both safari and chrome browsers.
This is a huge issue for us that is having a devasting impact on our plan to roll out the new site. Any help you can provide would be greatly appreciated.
~ Mark
Hello,
I have checked the URL you mentioned above, there are lots of JS errors in it, but none of them is from Toolset plugins, see your own screenshot:
https://toolset.com/wp-content/uploads/2021/05/2069071-Screen_Shot_2021_05_25_at_8.59.17_PM.png
I assume you are using some optimization plugins in your website, if it is, please follow our document to exclude some specific CSS/JS files from your optimization plugins:
https://toolset.com/faq/how-to-use-optimization-plugins-with-toolset/
If you are using the latest version of Toolset Blocks plugin, you need to exclude one more file:
/wp-content/plugins/toolset-blocks/vendor/toolset/common-es/public/toolset-common-es-frontend.js
Luo,
The folks at Mediavine think the issue is being caused by a conflict between Medivine's ad script and Toolset Blocks. The issues they're seeing are something they have not seen on any of the over 8,000 sites running their ads.
What they are asking for is help identifying the name of some of the variables Toolset is using that might be causing the errors. See the images from this first email to see which variables they are trying to identify. The relevant bit from Rachel's first email above is
"When I block the Toolset Blocks plugin scripts, the Maximum call stack size exceeded errors go away and everything loads normally. This error can appear when a script uses an infinite loop. Looking more closely at the Toolset Blocks code, it looks like it's making a call to jQuery 3.5.1, which might somehow be causing an infinite loop that's bogging down the browser."
As Mediavine has been digging deeper into this they've come to believe it might be caused by a conflict between Mediavine and Toolset blocks. Here is an excerpt from an email this afternoon...
"To give you a bit more context, this appears to be a conflict with our ads and how Toolset Blocks is calling jQuery. We suspect this is because the ads are adding a fair amount of elements and scripts to the content, or the DOM, that weren't previously there. With these extra elements, we believe that the maximum call stack size exceeded error is getting triggered due to a loop or coding error in the Toolset Block plugin, which is bogging down the browser. This theory seems tenable since shorter posts don't appear to have the same issue that longer posts are experiencing. Since this is not an error that we've ever seen on other sites running Mediavine ads, the conflict seems to stem from the Toolset Block plugin."
We have tested a number of permutations of the site today both using WP Rocket and Asset Cleanup Pro and having them turned off. The errors persist whether or not the caching plugins are running. I have also tested turning off all of Kadence's performance options along with the caching plugins and the errors are still there.
I previously had the javascript file you reference excluded from being optimized in Cloudflare and have added the CSS files. The errors are still persisting.
We really need some help from Toolset to figure out if and where the conflict is between Mediavine and Toolset. I just spent three months rebuilding and optimizing Umami to work with Toolset and the errors that are happening right now are creating an environment where we are crashing our users' browsers on mobile, which is 70 percent of our traffic. This is a completely unacceptable situation.
I'd appreciate it if you would look back at the info I first sent over from Mediavine and help us identify any potential conflicts between the two.
~ Mark
Since it is a compatibility issue with the "Medivine's ad script", according to our workflow, we need to provide detail steps to reproduce the same problem, please provide detail steps to reproduce the same problem in a fresh WP installation.
For example, you can install a test site(Fresh WP installation + the latest version of Toolset plugins), reproduce the same problem, then provide a copy of the test site in below private message box, you can put the package files in your own google drive disk, share the link only:
https://toolset.com/faq/provide-supporters-copy-site/
And describe detail steps to reproduce the same problem, private message box enabled.
Since you did not provide a copy of test site(fresh WP installation), I have to download the duplicator package file(3G size), it will take much time to download the files and duplicate the same problem.
And the staging site credentials you provided is not valid, I have tried the staging site URL:
hidden link
I can see only one htaccess window, and you did not provide the user name or wordpress credentials, so it is not valid to debug the problem too, and it does not help, please check it, make sure your staging website is valid to test and debug.
According to our support policy:
https://toolset.com/toolset-support-policy/
We cannot always fix compatibility issues arising from third-party plugins and themes. We do everything in our control to ensure Toolset compatibility with plugins and themes. However, if the issue lies with a third-party product, we will not be able to fix it, and you will need to contact the author of the plugin or theme in question.
Please try as I mentioned above:
please provide detail steps to reproduce the same problem in a fresh WP installation and plugin files required.
When you access the staging site enter dev into both the username and password. Picture attached.
To access the staging site go to hidden link and enter dev into both the user name and password fields to access the site. This will provide access to the site as a regular visitor. To login into the backend go to hidden link and use the admin credentials below.
I have an admin account set up for Toolset that works on the site I sent over and on our Staging Site.
User Name: guest@umami.site
Password: toolset
I sent over a copy of our full site because the issue appears to be more prevalent on long content than shorter content, which is something that couldn't be easily replicated in a fresh install. I also don't have an easy way to set up a fresh install and connect it with Mediavine in a way that would let you easily debug the site. Our hope is that our staging site would work for that.
I'd also like to say as a newer Toolset customer that a part of the reason I choose Toolset is because it had a reputation for good customer service, which is not something I've found in the past few months. This issue has been devastating to us as we launch the new version of our site and we're doing everything we can to try and fix it and it would be nice to feel like toolset was on our side and a partner in trying to get everything working.
~ Mark
Thanks for the details, I can see the problem in your staging site, and trying to reproduce the problem with the duplicator package, will update here if find anything
I can install the duplicate package file in my localhost.
And tried these:
1) Make sure the Toolset Blocks plugin 1.5.3 is installed/activated, there are total 31 plugins activated(I did not deactivate any plugin/theme)
2) Test the problem page in front-end:
hidden link
In my Chrome browser, I can see only two errors:
1) SSL error of Google tag manager, this should from other plugins
2) 404 error of an image
Both of them are not related with this ticket.
See my video capture:
hidden link
So the problem only exists in your website, it might be a server/compatibility issue of your website.
And there are lots of other JS errors in your staging site, I suggest you fix those JS errors first, for example:
- Deactivate other plugins/theme, test again,
- If the problem is fixed, then activate other plugins/theme one by one, try to locate the problem plugins
Lou,
I'm wondering if there is someone else at Toolset who is better able or more inclined to help us with this issue. It doesn't seem like the information we're providing is being used to identify and address the problem.
You will not be able to replicate the issue by installing the site on a localhost. Mediavine hidden link is an ad management company, one of the largest in the WordPress ecosystem. When you install our site on your localhost you are disabling Mediavine's ability to serve ads on the site, which only hides the issue.
I would respectfully ask that you or someone else at Toolset, read through all of the materials and images that we have provided so far. In working with Mediavine they have been able to identify that on longer content the code in Toolset Blocks is making calls to jQuery that are causing an infinite loop. Disabling Toolset Blocks or Mediavine eliminates the errors.
Unfortunately, we can not easily turn off either. Mediavine ads provide our primary source of revenue and Toolset forms the primary building block of our new site.
I would refer you to the following passage from an earlier email that describes what's happening.
___
"When I block the Toolset Blocks plugin scripts, the Maximum call stack size exceeded errors go away and everything loads normally. This error can appear when a script uses an infinite loop. Looking more closely at the Toolset Blocks code, it looks like it's making a call to jQuery 3.5.1, which might somehow be causing an infinite loop that's bogging down the browser."
As Mediavine has been digging deeper into this they've come to believe it might be caused by a conflict between Mediavine and Toolset blocks. Here is an excerpt from an email this afternoon...
"To give you a bit more context, this appears to be a conflict with our ads and how Toolset Blocks is calling jQuery. We suspect this is because the ads are adding a fair amount of elements and scripts to the content, or the DOM, that weren't previously there. With these extra elements, we believe that the maximum call stack size exceeded error is getting triggered due to a loop or coding error in the Toolset Block plugin, which is bogging down the browser. This theory seems tenable since shorter posts don't appear to have the same issue that longer posts are experiencing. Since this is not an error that we've ever seen on other sites running Mediavine ads, the conflict seems to stem from the Toolset Block plugin."
----
We have provided our staging site as a place for Toolset to further identify the problem and to test potential solutions that has Mediavine's scripts running on it. The site currently has the most recent version of Toolset Blocks installed.
I would appreciate being connected with your manager so we can find someone at Toolset who will work with us to fix this problem. We have already identified and provided documentation that the issue is coming from Toolset, so being told to try turning off all of our other plugins is more than a bit insulting.
Mark
As I mentioned above, according to our workflow, we need to provide detail steps to reproduce the same problem in the localhost:
https://toolset.com/forums/topic/toolset-blocks-code-causing-infinite-loop-and-breaking-site/#post-2069747
Since this issue is a compatibility issue with "Mediavine", and can not be reproduced in the localhost, please provide your staging website login details + FTP/sftp access in below private message box, so I can escalate this issue as an exception, and we can debug it in a live website with the same problem.
Private message box enabled again.
Thanks for the details, in order to debug this conflict issue, we need to deactivate plugins/theme in your website, please make sure your have backup your website, then update here.
On our staging site hidden link you have our permission to deactivate plugins, change code, etc in order to identify and fix the issue. We have backups of the site and can overwrite it from our live site.
Please contact us if you need to test or try things with our live site.
Mark
Thanks for the confirmation, I have escalated this issue as an exception, will update here if there is anything news
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Hi Mark
Luo has finished for the day, so let me share my findings with you directly as I know this is holding you up.
I managed to resolve the problem by disabling a script added by Toolset Blocks on single posts, where it doesn't seem to be needed. That's not to say that it is the cause of the issue, but there is clearly a compatibility problem between that script and one of the many scripts added by mediavine on that page.
Right now on your staging site this should be working. I suggest you double check that things appear as expected and that disabling that script doesn't cause any unintended side effects.
You'll note that I added a new code snippet at Toolset > Settings to dequeue the script, which you will need to add to your production server.
Also, the script doesn't ordinarily use the standard enqueuing method, making it difficult to dequeue, and to make that possible I also had to add the following constant to your wp-config.php file:
define( 'TB_SCRIPT_STYLE_LAZY_LOAD', false );
You'll also need to add that to your production server, too.
Let us know if you see any continued problems with that in place.
Hello,
Please let me know if you still need assistance for it.