Support » Plugin: WaterWoo PDF Plugin » FATAL ERROR: Allowed memory size of (x) bytes exhausted

  • Hello,

    I have my e-book, 350MB PDF file (1000 pages), on my small e-commerce (under construction by one year almost, unfortunately).
    I remember well that your plug-in worked well.

    Today I tried again, I bought my book (as test), make my order, I received the woocommerce email and, when I click the link to download the PDF, this is the error:

    Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 188263480 bytes) in /home/customer/xxx.com/public_html/wp-content/plugins/waterwoo-pdf/inc/tcpdf/tcpdf.php on line 19865

    It’s three years that I’m on the same hosting service (Siteground) and I have this is my server info:

    ———————————————
    Architettura del server Linux 3.12.18-clouder0 x86_64
    Server web Apache
    Versione di PHP 7.1.33 (supporta valori a 64bit)
    PHP SAPI cgi-fcgi
    Variabile PHP max input 20000
    Limite di tempo PHP 120
    Limite di memoria PHP 768M
    Max input time 120
    Dimensione massima di upload dei file 128M
    Dimensione massima del post PHP 128M
    ———————————————

    But, if I try with a small pdf, everything is fine.

    Siteground help desk told me that it’s a plug-in problem… But I’m not sure.
    So, I’m here to ask you what can I do to fix this problem.
    Thank you.

    • This topic was modified 5 months, 2 weeks ago by scarpinoc.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter scarpinoc

    (@scarpinoc)

    Ok,

    I talked with Siteground guys and I think they told me that yes, this plug-in asks too many resources. My question is why I was able to add watermark 1 years ago, on the same server. Maybe did they reduce resources (they changed server and now we are using Google farm)? Or is the plug-in more “hungry”?
    For my server, I found 200MB the max limit for a single file.

    Anyway, the solution I found is to split the 300MB .pdf in two files (PART 1 and PART 2) and I will ask clients to use a freeware portable software to merge the two files…
    Not very elegant solution but…

    Plugin Author Little Package

    (@littlepackage)

    @scarpinoc,

    Hello. Lots going on here. Thanks for providing so much information, though, that’s helpful.

    First of all, WaterWoo is basically a plugin which connects your WooCommerce download requests to the open source TCPDF library for PDF processing before download delivery. You can read more about TCPDF, especially their page about performance: https://tcpdf.org/docs/performances/ here.

    350MB is just about the biggest PDF anyone has ever admitted running through TCPDF to me. I’m surprised you managed to get it through even once on Siteground (shared? I assume) hosting. You’re asking a lot — perhaps too much — of a server to have it parse 1000 PDF pages (with images?) into PHP memory (!) and then prepare to spit out each page with an added watermark. Even cutting the file in half, I suspect you will still have intermittent failures.

    Bottom line, this plugin is intended to manipulate much smaller PDF files such as sheet music, sewing patterns, customized gift certificates and awards, and pamphlets. It would take significant server tuning, investment, as well as perhaps tweaking of TCPDF to get your large files through reliably. That’s not necessarily a problem with TCPDF, it’s a limitation of online computing.

    Thread Starter scarpinoc

    (@scarpinoc)

    Hello Little Package,

    I understood well and thank you for your detailed answer.
    So, in short, I was lucky to be able to add a watermark to 1000 pages (full JPG images).
    Now the two files are 550 pages each and it works fine and fast.
    My shaded server is able to give me back the downloaded file in a few second (4-5). So, I think it’s no bad.

    I think the problem is not the number of pages, but the PDF size.
    1000 pages super compressed can be 10 MB and the server is super fast to produce the output.
    But I have error with 200 pages at 230 MB.

    By the way, thank you again =)

    Plugin Author Little Package

    (@littlepackage)

    @scarpinoc

    I’m glad you understand, and that you are resourceful.

    Second by second, variables can change with server load, and from installation to installation this causes WAY too many scenarios to possibly address. Ultimately, all users of this plugin, if they are determined to use it despite initial difficulties, can work with server variables and tweak TCPDF (it’s open source, active on Github) to get it working for them.

    It generally works out-of-the box with smaller files and decent server settings, but folks like yourself who have either much larger files or insufficient CPU/memory will find themselves needing to tune their systems.

    raetseldetektive

    (@raetseldetektive)

    Hi,

    since last update of this great plugin I also encounter memory exhausted problems. As there where no problems before I guess memory consumption increased a lot in newest version as the problematic pdf was successfully watermarked in the past and now it tries to allocate about 400MB, which is far more than the server limit of 256MB which was sufficient in the past.

    Here the error message:
    Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 39846476 bytes) in /......../wordpress/wp-content/plugins/waterwoo-pdf/inc/tcpdf/tcpdf.php on line 19870

    Information about the problematic pdf:

    # pdfinfo sample.pdf
    Producer:       PyPDF2
    Tagged:         no
    UserProperties: no
    Suspects:       no
    Form:           none
    JavaScript:     no
    Pages:          50
    Encrypted:      no
    Page size:      595.247 x 841.861 pts (A4)
    Page rot:       0
    File size:      41977046 bytes
    Optimized:      no
    PDF version:    1.3

    After stripping down size of PDF it is working fine again. On top I am upgrading our hosting contract to allow 512 MB script memory usage to be on the safe side, but still I guess something significantly changed in memory consumption.

    Thread Starter scarpinoc

    (@scarpinoc)

    Hi raetseldetektive,

    this is exactly what I think. Something is changed in the plug-in in the last versions.
    In my situation, since Sitegrond changed servers, I had no possibility check if the problem was the hosting service or the plug-in. Ok, I could donwngrade and to some tests but, I was too busy.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.