Support » Plugin: footnotes » PHP Memory limit on a post with a lot of footnotes

  • ResolvedPlugin Contributor Aharon

    (@spaceling)


    I’m getting the WordPress “white screen of death” on a particularly long post with a lot of footnotes. I know that the footnotes plugin is the culprit since I test ran the post with all of the bracketed footnote tags removed, and it displayed fine. In another test post I edited the post to remove some content and it displays fine until I hit around 285 footnotes.

    I’d like to know two things: one practical and the other theoretical.

    First the practical: what can I do to get my post to display with all my 318 footnotes? (The total word count for the post with the footnotes is 25,290.)

    Second, the theoretical: what is the maximum number of footnotes (or size of all footnotes) that wordpress can display under default PHP server limits? (I’ve defined my WP_MEMORY_LIMIT in my wp_config.php file as 128M.)

    I’m sharing the raw text of my too-many-footnotes post at my dropbox here: https://www.dropbox.com/s/h90sz2ruzqrb1fw/too_many_footnotes-post.txt?dl=1

    (If you’re able to troubleshoot, note that in the text linked above I use [foot][/foot] to define footnotes using the footnotes plugin.)

    I run some other plugins on my site which add code to pages but haven’t seen this problem crop up for a while. It’s only ever been a problem for long posts on my site.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Contributor pewgeuges

    (@pewgeuges)

    @spaceling

    Thank you for reporting this problem and for going to the trouble to investigate it. To fix it I’d strongly recommend to increase the WP_MEMORY_LIMIT.

    This number should match the memory limit set in the website’s hosting.
    In cPanel it can be set under PHP Version > Options tab > memory_limit.
    Options include: ’64M’; ‘128M’; ‘192M’; ‘256M’; ‘368M’; ‘512M’.

    I was not aware that the Footnotes plugin is consuming that much memory, and I never got the idea to run a stress test either, therefore we are grateful for your investigation and issue report.

    Thank you for sharing the article’s source code. When using it for testing in a private post I’ve got twice an HTTP error 500 when WP_MEMORY_LIMIT is 40M, the WP default for single site, and not (twice) when WP_MEMORY_LIMIT is as low as 64M. It may depend on many factors and I’m ignoring too much things about the Footnotes plugin to advise in detail. For now I only can recommend to expand the WP_MEMORY_LIMIT bottleneck, in the hope that this will fix the problem.

    Please keep us posted, and if WP_MEMORY_LIMIT does not fix it, Footnotes’ current developers will certainly advise better.

    Best regards.

    Footnotes 2.1.3 (older)
    PHP 7.4.24
    WordPress 5.8.1

    using [foot] and [/foot]

    – Start a new post
    – Paste your text
    – Click preview

    The new tab shows all the content, including all of the footnotes.

    Plugin Contributor Aharon

    (@spaceling)

    Some more frustration, alas.

    I increased the PHP memory limit via our cPanel, and our WP_MEMORY_LIMIT via wp_config.php (both to 512M). I also increased the PHP post_max_size to 64M for good measure. I cleared the site cache.

    Our WordPress is the latest v.5.8.1. Our PHP is v7.3.32; we see site breakage when we update to 7.4.25. After I tried updating the PHP version to 7.4.25, I broke the site and then downgraded back to 7.3.32. (Footnotes plugin is v. 2.7.3)

    Success with 286 footnotes: https://opensiddur.org/?p=40219

    Failure with 318 footnotes: https://opensiddur.org/?p=40217

    At first I thought I had a breakthrough, but on review I see that I was only succeeding with the version of the post where I removed all the bracketed footnotes plugin tags.

    • This reply was modified 9 months, 3 weeks ago by Aharon.
    • This reply was modified 9 months, 3 weeks ago by Aharon.
    • This reply was modified 9 months, 3 weeks ago by Aharon.
    • This reply was modified 9 months, 3 weeks ago by Aharon.
    • This reply was modified 9 months, 3 weeks ago by Aharon.
    • This reply was modified 9 months, 3 weeks ago by Aharon.
    Plugin Contributor pewgeuges

    (@pewgeuges)

    @spaceling @spiralofhope2

    Thank you @spiralofhope2 for running a test.

    @spaceling, @spiralofhope2’s success hints that it might be an issue with the PHP version, or with the Footnotes version. If PHP 7.4.25 does not work for your website, perhaps its theme is using deprecated language features, among those listed in https://www.php.net/manual/en/migration74.deprecated.php. Although I advocate following WordPress in being PHP 5.6 compatible, I’d recommend staying safe by upgrading to PHP 8.0 if possible.

    Of course deleting notes is unacceptable, the software must handle the content full-length.

    • This reply was modified 9 months, 3 weeks ago by pewgeuges.
    • This reply was modified 9 months, 3 weeks ago by pewgeuges.
    Plugin Contributor Aharon

    (@spaceling)

    I managed to upgrade to PHP 7.4.25. (PHP 8.0 is not yet an option with my webhost.)

    The upgrade made no difference for resolving the problem at hand, but at least that’s one issue we can discount as the source of the problem.

    • This reply was modified 9 months, 3 weeks ago by Aharon.
    Plugin Contributor pewgeuges

    (@pewgeuges)

    Thank you for the update. I think that now we can discount the theme as well since it works in a new multisite site using Atahualpa theme with the source you shared. All footnotes processed (totaling 307) using Footnotes 2.7.3, PHP 7.4, PHP 256M limit as the lowest available option, and default WP_MEMORY_LIMIT 64M.

    I really hoped it would break, but I’m still failing to reproduce the bug.

    Plugin Contributor Aharon

    (@spaceling)

    Hmmm… well, I will try turning off some of the more basic level plugins we use like Autoptimize and Cache Enabler and observe whether that changes anything. I’ve been looking at our error logs but so far nothing. A mystery.

    • This reply was modified 9 months, 2 weeks ago by Aharon.
    Plugin Contributor pewgeuges

    (@pewgeuges)

    Thanks for the update. Using Health Check & Troubleshooting https://wordpress.org/plugins/health-check/ would allow to keep them all running while checking how it works out when turned off.

    Conversely I’m going to install the two mentioned plugins.

    Update: None of the cited plugins appear as the culprits.
    All 307 notes still displaying, also after activating virtually all optimization options, minifying, clearing site cache after updates, no problem spotted so far.

    The origin may perhaps be a conflict with another plugin.

    • This reply was modified 9 months, 2 weeks ago by pewgeuges.

    re. Autoptimize; given it does regex-based parsing of the full HTML to extract JS & CSS, having to parse a huge amount of HTML *could* cause a segfault of the PCRE component in PHP, leading to a WSOD. in that case disabling optimization of said page (in the post meta-settings on said page/ post) would be the most simple solution.

    frank (ao dev)

    Plugin Contributor Aharon

    (@spaceling)

    Thank you– I found the culprit: External Links, a plugin which I see hasn’t been updated in five years but is still in use by 20,000 (!) sites.

    I have no idea why this plugin would conflict with Footnotes in just this circumstance, but thank you, @pewgeuges, for your help and encouragement in troubleshooting this issue.

    • This reply was modified 9 months, 2 weeks ago by Aharon.
    Plugin Contributor pewgeuges

    (@pewgeuges)

    @spaceling @optimizingmatters

    Thank you for all feedback and advice. No problem, great to hear that the issue is solved. But indeed, the more troubling is that adding External Links does not break the test post I’ve set up for the purpose.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘PHP Memory limit on a post with a lot of footnotes’ is closed to new replies.