@datango opened this Issue on February 3rd 2021

matomo/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php(2010)
Warning - array_merge(): Expected parameter 1 to be an array, null given - Matomo 4.1.1

(when running ./console core:archive)

@diosmosis commented on February 4th 2021 Member

@datango Are you using any scheduled reports? Can you try clicking the 'Send report now' link for each on the 'Email Reports' admin page to find which one is causing this error?

Can you also provide the core:archive output?

And can you let us know if you're using matomo from git or are installing composer dependencies yourself?

@davidlemaitre commented on March 1st 2021

Facing with this issue on Matomo 3.14.1 for sending scheduled reports. The first ones are OK, for the next 6 ones, this error occurs :
WARNING [2021-03-01 00:08:13] 28013 /var/www/html/libs/Zend/Mail/Protocol/Abstract.php(324): Notice - fwrite(): send of 6 bytes failed with errno=32 Broken pipe - Matomo 3.14.1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already).

And for the final reports, these errors occur :
INFO [2021-03-01 00:08:52] 28013 Scheduler: executing task Piwik\Plugins\ScheduledReports\API.sendReport_65... WARNING [2021-03-01 00:08:55] 28013 /var/www/html/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php(2002): Warning - array_map(): Expected parameter 2 to be an array, bool given - Matomo 3.14.1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) WARNING [2021-03-01 00:08:55] 28013 /var/www/html/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php(2010): Warning - array_merge(): Expected parameter 2 to be an array, null given - Matomo 3.14.1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) WARNING [2021-03-01 00:08:55] 28013 /var/www/html/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php(1800): Warning - count(): Parameter must be an array or an object that implements Countable - Matomo 3.14.1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) WARNING [2021-03-01 00:08:55] 28013 /var/www/html/vendor/tecnickcom/tcpdf/tcpdf.php(5268): Warning - count(): Parameter must be an array or an object that implements Countable - Matomo 3.14.1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) WARNING [2021-03-01 00:08:55] 28013 /var/www/html/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php(2002): Warning - array_map(): Expected parameter 2 to be an array, bool given - Matomo 3.14.1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) WARNING [2021-03-01 00:08:55] 28013 /var/www/html/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php(2010): Warning - array_merge(): Expected parameter 1 to be an array, null given - Matomo 3.14.1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) WARNING [2021-03-01 00:08:55] 28013 /var/www/html/vendor/tecnickcom/tcpdf/tcpdf.php(4085): Warning - Invalid argument supplied for foreach() - Matomo 3.14.1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already).

Using official matomo Docker image. When I click on "Send report now", the problematic reports are sent without errors.

@diosmosis commented on March 1st 2021 Member

Hi @davidlemaitre, thanks for the info! For the reports that failed, would you be able to provide the report configuration found in the "Email Reports" admin page? Is there anything different about the ones that failed compared to the ones that succeeded? (Note: if you do not wish to post that information publicly, you can email me: dizzy@innocraft.com)

@Findus23 commented on March 1st 2021 Member

WARNING [2021-03-01 00:08:13] 28013 /var/www/html/libs/Zend/Mail/Protocol/Abstract.php(324): Notice - fwrite(): send of 6 bytes failed with errno=32 Broken pipe - Matomo 3.14.1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already).

In Matomo 4 the old Mail library has been replaced with a modern one, so this error might be fixed there

@crazy-max commented on March 2nd 2021

@Findus23 Same on Matomo 4.2.1:

WARNING [2021-03-02 06:59:13] 992  /var/www/matomo/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php(2010): Warning - array_merge(): Expected parameter 1 to be an array, null given - Matomo 4.2.1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
@sgiehl commented on March 2nd 2021 Member

@crazy-max I'm not sure how that actually happens for you, but I assume this might be a bug in TCPDF. It actually calls an array_merge on parameters, when one might not be an array, on purpose.
As TCPDF is kind of unmaintained at the moment we need to see how to fix that.

@davidlemaitre commented on March 2nd 2021

Hi @diosmosis, we have a lot of users configuring scheduled reports keeping the default hour. At different hours, all reports are sent successfully but there are only 2 reports maximum to send.

I checked matomo_report db table, I found nothing different between the succeeded reports and the failed ones except for "ts_last_sent" field containing an old date but this is also the case for the last 2 succeeded reports at hour 0.

A CSV export of the first failed report with the warning fwrite(): send of 6 bytes failed with errno=32 :

"57";"51";"*****";"Rapport mensuel*****";NULL;"month";"0";"email";"pdf";"[""VisitsSummary_get"",""Actions_get"",""Actions_getPageUrls"",""Referrers_get""]";"{""displayFormat"":""1"",""emailMe"":false,""evolutionGraph"":false,""additionalEmails"":[""i*@*.fr"",""p*@*.com""]}";"2020-08-06 07:16:21";"2021-01-01 00:06:12";"0";"0";"30";"month"

And a CSV export of the final report causing the ton of warnings (the last one is also about fwrite(): send of 6 bytes failed with errno=32):

"65";"25";"*****";"*** mensuel";NULL;"month";"0";"email";"pdf";"[""VisitsSummary_get"",""DevicesDetection_getType"",""Resolution_getResolution"",""Actions_get"",""Actions_getPageUrls"",""Actions_getEntryPageUrls"",""Actions_getExitPageUrls"",""Actions_getPageTitles"",""Actions_getSiteSearchKeywords"",""Actions_getPageUrlsFollowingSiteSearch"",""Actions_getSiteSearchNoResultKeywords"",""Actions_getDownloads"",""VisitorInterest_getNumberOfVisitsPerVisitDuration"",""VisitorInterest_getNumberOfVisitsPerPage"",""Referrers_get"",""Referrers_getKeywords""]";"{""displayFormat"":""1"",""emailMe"":true,""evolutionGraph"":false}";"2021-02-22 08:23:58";"2021-02-22 08:53:39";"0";"0";"1";"month"

@sgiehl commented on March 2nd 2021 Member

@davidlemaitre Does the fwrite(): send of 6 bytes failed with errno=32 error only occur when the report is sent, or also when you click the download button for the report in the UI?
That error message for example might occur when the mail server closes the connection due to incorrect TLS version or similar.

@davidlemaitre commented on March 2nd 2021

@sgiehl these errors occur only for some scheduled reports. If I click on "Send report now" or "Download" buttons, nothing to notice in the logs.

@sgiehl commented on March 3rd 2021 Member

@davidlemaitre which PHP version are you using? Also are you using a cron for archiving? Maybe the log level is different for webserver and cli and so you can see the errors only when triggered through cli and not UI maybe?

@davidlemaitre commented on March 8th 2021

@sgiehl Using official Matomo Docker image version 3.14.1 (PHP 7.4 embedded). A cron is used for archiving every hour.
Found also this fwrite(): send of 6 bytes failed with errno=32 error for notifyTrackingFailures task :

INFO [2021-03-08 00:09:45] 24948 Scheduler: executing task Piwik\Plugins\CoreAdminHome\Tasks.notifyTrackingFailures... WARNING [2021-03-08 00:09:45] 24948 /var/www/html/libs/Zend/Mail/Protocol/Abstract.php(324): Notice - fwrite(): send of 6 bytes failed with errno=32 Broken pipe - Matomo 3.14.1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)

@sgiehl commented on March 8th 2021 Member

@davidlemaitre could you try if running the command works for you and if the email is sent our correctly:

./console core:test-email your<a class='mention' href='https://github.com/email'>@email</a>
@davidlemaitre commented on March 8th 2021

Test email received without errors. My problem is about some reports sent at default hour (majority of users don't change the value in the settings of the report), it seems there errors appear only when there is a lot of reports to send.

@sgiehl commented on March 8th 2021 Member

Might it be possible that your mail server cuts the connection when too many emails are sent?

Powered by GitHub Issue Mirror