dsifford / academic-bloggers-toolkit

WordPress plugin providing an all-in-one solution for effective academic blogging.
https://wordpress.org/plugins/academic-bloggers-toolkit/
GNU General Public License v3.0
120 stars 38 forks source link

Mysterious ABT server error #595

Open nerdyandawesome opened 4 years ago

nerdyandawesome commented 4 years ago

ABT Version: Version 5.2.2

PHP Version: 7.3.12

Theme: Genesis Foodie Pro 4.0.0

Plugin List:

Browser: Google Chrome (Version: xxx) 78.0.3904.108 (Official Build) (64-bit) (cohort: Stable)

Expected behavior: Normal html

Actual behavior: Whenever ABT is active while Thrive Leads & Thrive Products are also active, I get the following error in my server: Backend fatal error: PHP Fatal error: Uncaught RuntimeException: Action already fired for JSON data with ID abt-bibliography-json in /home/parentin1/domains/staging.parentingforbrain.com/public_html/wp-content/plugins/academic-bloggers-toolkit/php/utils.php:23\nStack trace:\n#0 /home/parentin1/domains/staging.parentingforbrain.com/public_html/wp-content/plugins/academic-bloggers-toolkit/php/frontend.php(65): ABT\Utils\add_json_script('abt-bibliograph...', '\n apply_filters('', Array)\n#3 /home/parentin1/domains/staging.parentingforbrain.com/public_html/wp-includes/plugin.php(544): WP_Hook->do_action(Array)\n#4 /home/parentin1/domains/staging.parentingforbrain.com/public_html/wp-includes/class-wp-query.php(4229): do_action_ref_array('the_post', Array)\n#5 /home/parenti in /home/parentin1/domains/staging.parentingforbrain.com/public_html/wp-content/plugins/academic-bloggers-toolkit/php/utils.php on line 23\n

Console messages:

// Paste messages here
No error message is shown on the console. But the above error is found in server error log.
And at the end of the web page, it says:

There has been a critical error on your website.
Learn more about debugging in WordPress.

This is the part that is breaking the css of my page. Function-wise, the page loads fine. But this mysterious error renders the error css, messing up the whole page's layout.

Because the server error appears at the same time (the only error), I link these 2 things together, but of course I can't be sure.
dsifford commented 4 years ago

That error occurs when data is attempted to be passed from the server to the frontend of the site after the opportunity for that data to be passed closes.

Not sure why that might be happening, but my guess is that something to do with the two plugins you mentioned is blocking that opportunity either intentionally or it's simply just taking too long to accomplish whatever it is it's trying to accomplish.

Also, you didn't mention it, but I've had several people report issues with WP Rocket in the past.

nerdyandawesome commented 4 years ago

Thanks for your reply. I found out that if I commented out the following lines, everything would be back to normal.

php > utils.php > line 22-24 // if ( did_action( $action ) ) { // throw new \RuntimeException( 'Action already fired for JSON data with ID ' . $id ); // }

Will it be detrimental if I do that?

dsifford commented 4 years ago

Yep, because although the plugin doesn't error now, you aren't guaranteed to have the data you need when the page loads. So it'll more than likely error in more unpredictable ways.

nerdyandawesome commented 4 years ago

I see. Is there a gentler way to throw this exception so it doesn't mess up the page? The page loads fine and then the error at the end injects a bunch of css that messes it up. Missing a citation is not that much of a "critical error" that renders such a treatment on frontend, right?

dsifford commented 4 years ago

Missing a citation is not that much of a "critical error" that renders such a treatment on frontend, right?

Debatable. But I'll think about it.

The foundational issue though is that one of your other plugins is doing some funny business preventing this one from working properly.

nerdyandawesome commented 4 years ago

I know, but it's not just 1 other plugin. 2 others are in play here. All 3 plugins need to be present to create this.

So when 3 people don't play well together (2 are their people), we can only find ways to ignore the bullies. ;)

Thanks a lot for considering this.

byronrode commented 4 years ago

Also seeing this issue with cited references when trying to view the frontend, however, it kills the entire article, not affecting CSS.

Site is built using a custom theme, and the current list of plugins (below, all latest versions) and using latest version of WP.

Academic Blogger's Toolkit (Version 5.2.2)
Advanced Custom Fields PRO
Category Order and Taxonomy Terms Order
Ninja Forms
No Category Base (WPML)
Permalink Manager Lite
Search Console
Simple Page Ordering
VWO
Yoast SEO Premium

Stacktrace (domain redacted)

2019/12/13 08:44:08 [error] 10568#0: *300628 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught RuntimeException: Action already fired for JSON data with ID abt-bibliography-json in /var/www/redacted/htdocs/wp-content/plugins/academic-bloggers-toolkit/php/utils.php:23
Stack trace:
#0 /var/www/redacted/htdocs/wp-content/plugins/academic-bloggers-toolkit/php/frontend.php(65): ABT\Utils\add_json_script('abt-bibliograph...', '\n<section aria-...')
#1 /var/www/redacted/htdocs/wp-includes/class-wp-hook.php(290): ABT\Frontend\collect_bibliography(Object(WP_Post))
#2 /var/www/redacted/htdocs/wp-includes/class-wp-hook.php(312): WP_Hook->apply_filters('', Array)
#3 /var/www/redacted/htdocs/wp-includes/plugin.php(544): WP_Hook->do_action(Array)
#4 /var/www/redacted/htdocs/wp-includes/class-wp-query.php(4229): do_action_ref_array('the_post', Array)
#5 /var/www/redacted/htdocs/wp-includes/class-wp-query.php(4336): WP_Query->setup_postdata(Object(WP_Post))
#6 /var/www/redacted/ht" while reading response header from upstream, client: 102.69.132.87, server: www.redacted, request: "GET /testing-references/ HTTP/2.0", upstream: "fastcgi://127.0.0.1:9090", host: "www.redacted"

Going to try do some deep-diving, but the staging environment is seeing different issues (and we cannot even add citations as there are JS errors), so I cannot see if it is related to the theme or something else.