Skip Navigation

[Resolved] Fatal error due to respectively Types or Views, each triggered in different file

This support ticket is created 3 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

This topic contains 1 reply, has 1 voice.

Last updated by smileBeda 3 years, 5 months ago.

Author
Posts
#2082595

On this site a fatal error is triggered when editing existing or adding new posts.

When Views and Types are active the error is:

[10-Jun-2021 08:31:56 UTC] PHP Fatal error:  Uncaught Error: Maximum function nesting level of '256' reached, aborting! in /wp-includes/class-wp-object-cache.php:281
Stack trace:
#0 /wp-includes/cache.php(125): WP_Object_Cache->get(1551, 'posts', false, NULL)
#1 /wp-includes/class-wp-post.php(239): wp_cache_get(1551, 'posts')
#2 /wp-includes/post.php(782): WP_Post::get_instance(1551)
#3 /wp-content/plugins/wp-views/vendor/toolset/dynamic-sources/server/Integrations/Views.php(100): get_post(1551)
#4 /wp-includes/class-wp-hook.php(292): Toolset\DynamicSources\Integrations\Views->adjus in /wp-includes/class-wp-object-cache.php on line 281

This then produces a following JS error in the Post Edit Screen console:

Failed to load resource: the server responded with a status of 500 (Internal Server Error) on /wp-json/wp/v2/blocks?per_page=100&context=edit&_locale=user
Unhandled Promise Rejection: [object Response] in /wp-includes/js/dist/vendor/wp-polyfill.min.js?ver=7.4.4

When Views is deactivated the error is:

[10-Jun-2021 08:37:14 UTC] PHP Fatal error:  Uncaught Error: Maximum function nesting level of '256' reached, aborting! in /wp-includes/meta.php:530
Stack trace:
#0 /wp-includes/meta.php(530): is_numeric(1551)
#1 /wp-includes/meta.php(506): get_metadata_raw('post', 1551, 'wpcf-pattern-ph...', false)
#2 /wp-includes/post.php(2226): get_metadata('post', 1551, 'wpcf-pattern-ph...', false)
#3 /wp-content/plugins/types/application/models/field/gateway/wordpress-post.php(34): get_post_meta(1551, 'wpcf-pattern-ph...')
#4 /wp-content/plugins/types/application/models/field/mapper/abstract.ph in /wp-includes/meta.php on line 530

Here is an AIO of the site stripped down to only Views and Types, using default theme, with re-installed WordPress, no Custom Code.
You just need to add a new post, then wait for the error to pop into the console and observe the error log meanwhile.
<removed by author>

Note, on the live server, the error happens again in another location and is a Memory Exhaustion, however, the same JS error will be shown and I believe it doesn't really matter what PHP error happens, something is overflowing memory and it is due to both or just Types/Views.
As soon the Types plugin is disabled, the issue is resolved.

While I cannot replicate this issue on a fresh install, I clearly can replicate it on this stripped down website, and it is resolved as soon we disable Toolset, which leaves me no choice but to ask here for a deeper look and eventual resolution.
I am relatively sure this has to do with the amount of Fields/Posts used, thus why I can't replicate it on a clean install...

Note that on my local test site of which the above AIO is a copy of, I already deleted all Types Fields and Relationships as well (after talking the AIO backup I sent you) and the error persists, thus, this is now almost a clean site on my local and the problem did not go away.
I am experiencing the issue both on apache and nginx of which one has 5GB ram, so this is not a server issue either.

The only what finally resolved the issue was to delete ALL posts from the _posts table, but that is not a solution I can adapt in the live install
Given that, I suspect some post somewhere has a ShortCode or Toolset Block in it that somehow manages to exhaust all memory
But why this is even affecting things when I edit or add a new post, and/or why this has to be failing in a Fatal error that is resolved as soon I disable Types, is not clear to me.

I hope you can help with this...

Thanks

#2082651

Ok ignore this blunder.

The issue was due to a reusable block (ID 1551) with Toolset Dynamic blocks in it.
For whatever reason, named block looped infinitely.
When you edit posts, the Gutenberg thingy by default tries to get all Re-usable blocks to put them in the block navigator. It also executes each of those blocks and renders them, even if you do not use them on the page.

Thus, the error happened even if the block was not in use.

Not sure what inside the Reusable block itself produced this failure, and honestly I couldn't care less:
time to delete the last remnants of Blocks on this site as well 🙂

Sorry the noise...