salesagility / SuiteCRM

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
4.34k stars 2.05k forks source link

Invoice print as PDF generates thousands of lines in Apache error.log #8024

Open mikebakke opened 4 years ago

mikebakke commented 4 years ago

Issue

Every time an invoice is printed and saved as PDF I see up to 10,000 warnings/notices written to my apache error.log. The PDF file is generated correctly.

Expected Behavior

  1. The PDF file should be generated correctly
  2. No relevant messages in suitecrm.log

Actual Behavior

  1. The PDF file is generated correctly
  2. c. 10,000 messages written to /var/log/apache2/error.log

Possible Fix

Steps to Reproduce

  1. Add a 1 line product
  2. Use the sample invoice template to create a template
  3. Create an invoice referencing the product
  4. Action: Print as PDF

Context

This is flooding my error.log with messages which are not (apparently) causing any issue. The impact is twofold.

  1. During invoicing periods the logfile grows to an extent where it threatens integrity of the system
  2. The hundreds/thousands of lines make it impossible to spot real errors

Your Environment

NOTE: Although identified on a live system - I recreated with a virgin install this morning from the distribution so I believe this is as clean as system as one could have. The diagnostics and sample error log are from that fresh install.

Updated: 16:40 UTC Thanks to a response on the forums I'm told that the majority of these are notices which need not cause concern. After adding ~E_NOTICE to php.ini, the message count for the print transaction reduced to c50 lines of warnings. Adding ~E_WARNING removes those too however it seems that they may mask genuine warnings so for now I will leave.

Will close for now.

pgorod commented 4 years ago

@Dillon-Brown even though it's true these are just NOTICEs I think the amount is so high it would merit a fix. It's likely this even impacts performance. What do you think?

Dillon-Brown commented 4 years ago

@Dillon-Brown even though it's true these are just NOTICEs I think the amount is so high it would merit a fix. It's likely this even impacts performance. What do you think?

I think every notice merits a fix :D. I'm not really sure what the best way to go about tracking areas that need specific attention is though.

pgorod commented 4 years ago

Maybe this one can simply be re-opened. It has steps to reproduce, and among the many notices we should fix, this one seems particularly aggressive in the number of messages generated...

pgorod commented 4 years ago

The errors in the logs are

PHP Notice: Undefined index: assigned_user_id_address_street in /var/www/html/embee/modules/AOS_PDF_Templates/templateParser.php on line 162

This appears once for each field, 6725 times.

And

PHP Notice: Undefined property: User::$authenticate_id in /var/www/html/embee/modules/AOS_PDF_Templates/templateParser.php on line 124

Which also appears once for each field, total 1251 times.

And then there are other various sequences with PDF_Lib errors...

pgorod commented 4 years ago

For that first error (line 162), sometimes it seems to be concatenating this way fieldName_fieldName

instead of the expected moduleName_fieldName

The latter case makes more sense, but also produces the warning, though.

connorshea commented 4 years ago

I was dealing with the same problem after upgrading from 7.9.x to 7.10.19 and I did some backports into our CRM to fix them. I also opened #7899 and #7900, though I don't remember if that was specifically relevant to the PDF exporting.

We backported #6375 to our 7.10.19 install about 3 weeks ago and it seems to have fixed a lot of these errors, and AFAIK hasn't introduced any new problems. It'd probably be worth updating that PR and getting it merged.

The mPDF update also helps fix most of the remaining notices/warnings (#7948), though we haven't tested that one as much, and haven't deployed our backport of it yet.