I have recently installed Matomo (formerly Piwik) on a test server for collecting analytics, and I have noticed that there is this annoying error message that shows up 3-4 times on the main page:

WARNING: /var/www/public_html/matomo/libs/Zend/Db/Statement/Mysqli.php(105): Warning - Error while sending STMT_CLOSE packet. PID=18123 - Matomo 3.3.0 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)

I'm going to try to fix that here. I found that the problem is that MySQL times out waiting for it to complete the task, so let's change some settings in MySQL.

wait_timeout = 60
max_allowed_packet = 128MB

I did this on VestaCP, by going into the "Server" tab, then MySQL -> Configure. Once changed, click save and then refresh Piwik/Matomo and it is fixed!

Please let me know if this has helped you, in the comments :)