bmlt-enabled / bread

BMLT Meeting List Generator Plugin For Wordpress https://wordpress.org/plugins/bread/
https://wordpress.org/plugins/bread/
GNU General Public License v2.0
6 stars 9 forks source link

Log File Spammed Until Disk Full #157

Closed DeathCamel58 closed 3 years ago

DeathCamel58 commented 3 years ago

Bread is causing a massive log file on some of our sites. This log file grows with repeating lines until disk is used.

Apache Server version: Apache/2.4.46 (cPanel) phpinfo() html file: PHP 7.3.26 - phpinfo().zip Wordpress 5.6 Wordpress Plugins

Here's a small excerpt of the log below.

[21-Jan-2021 23:58:27 UTC] PHP Warning:  fread(): supplied resource is not a valid stream resource in /home/grscna5/public_html/gsana/wp-content/plugins/bread/mpdf/vendor/setasign/fpdi/src/PdfParser/StreamReader.php on line 465
[21-Jan-2021 23:58:27 UTC] PHP Warning:  feof(): supplied resource is not a valid stream resource in /home/grscna5/public_html/gsana/wp-content/plugins/bread/mpdf/vendor/setasign/fpdi/src/PdfParser/StreamReader.php on line 467

170,000 lines later (1 second later)

[21-Jan-2021 23:58:28 UTC] PHP Warning:  feof(): supplied resource is not a valid stream resource in /home/grscna5/public_html/gsana/wp-content/plugins/bread/mpdf/vendor/setasign/fpdi/src/PdfParser/StreamReader.php on line 467
[21-Jan-2021 23:58:28 UTC] PHP Warning:  fread(): supplied resource is not a valid stream resource in /home/grscna5/public_html/gsana/wp-content/plugins/bread/mpdf/vendor/setasign/fpdi/src/PdfParser/StreamReader.php on line 465
[21-Jan-2021 23:58:28 UTC] PHP Warning:  feof(): supplied resource is not a valid stream resource in /home/grscna5/public_html/gsana/wp-content/plugins/bread/mpdf/vendor/setasign/fpdi/src/PdfParser/StreamReader.php on line 467
[21-Jan-2021 23:58:28 UTC] PHP Warning:  fread(): supplied resource is not a valid stream resource in /home/grscna5/public_html/gsana/wp-content/plugins/bread/mpdf/vendor/setasign/fpdi/src/PdfParser/StreamReader.php on line 465

These same log lines repeat until disk is filled.

jbraswell commented 3 years ago

Until this is fixed, can you set up log file rotation to prevent the disk from filling up? Or change the warning/logging settings in PHP temporarily?

otrok7 commented 3 years ago

Please check that the root directory of your wordpress installation is writable by the WebServer process, as is the temp directory (if necessary, set it in wp-config) and bread's directory (wp-content/plugins/bread).

jbraswell commented 3 years ago

@DeathCamel58 the error message indicates that a stream resource is invalid. The FPDI library for some reason continues to the to iterate an invalid resource (probably a file, perhaps memory, but probably a file), thus filling the log file with warnings. What @otrok7 is suggesting is that you make sure the paths it could be attempting to access are writable, which could resolve the error. It would be helpful if you could determine what path it's attempting to access, as we've never seen this particular error before.

JanSlabon commented 3 years ago

This issue is also reported for mPDF here. There's also a link to a SO question with information how to bypass this issue (harden the references to the file-handles used by the stream reader class). The root problem is in the TOC functionality of mPDF.

otrok7 commented 3 years ago

@DeathCamel58, please export your settings (you do this from the "Configuation" Tab) and post them here. Assuming it really is as Jan suggests, then I want to figure out why it is affecting you and not other people using Bread, and so, maybe find a workaround until Mpdf is fixed.

DeathCamel58 commented 3 years ago

When diagnosing the issues on our site initially, I saw it was bread, disabled and reenabled it, and saw the issue persist. Going back to the affected site and enabling it isn't causing the issue to re-appear currently.

I'm closing this issue until I notice it happen again (multiple sites on our server had this issue, many have not been affected by this issue).

JanSlabon commented 3 years ago

The problem is that it is only triggered if PHPs garbage collector is triggered and frees "unused" objects. This requires that there's a huge amount of data in memory.

jbraswell commented 3 years ago

Reopened, as Minnesota is also seeing this issue.

jbraswell commented 3 years ago

https://stackoverflow.com/questions/65596688/importing-large-number-of-pdfs-into-mpdf-is-causing-fopen-to-fail/65633667#65633667 may be helpful.

otrok7 commented 3 years ago

Please send me the JSON export file, let me see if I can reproduce the problem. Or maybe a stack trace. Minnestota has been using bread for a while...are they doing something new (eg., are they moving from flyer to booklet format)?

jbraswell commented 3 years ago

I asked them on the Facebook group to send the json export to one of us.

This is the message they originally posted:

We are having issues with space and discovered our debug log is HUGE! We have also noticed that it has many items related to bread,

[11-Jan-2021 20:03:20 UTC] PHP Warning: fread(): supplied resource is not a valid stream resource in /home/customer/www/naminnesota.org/public_html/wp-content/plugins/bread/mpdf/vendor/setasign/fpdi/src/PdfParser/StreamReader.php on line 465 This is one thing we are seeing. We have had a n issue with bread for several months. The only way we can get the PDF to generate is using tomato.

So it sounds like they are having this issue among others.

otrok7 commented 3 years ago

Fixed in 2.5.8