There are lot of errors 
A dead lock occurs.
Error query: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction In query: INSERT INTO matomo_log_link_visit_action (idvisit, idsite, idvisitor, idaction_url, idaction_url_ref, idaction_name_ref, server_time, idpageview, pageview_position, time_spent_ref_action, idaction_name) VALUES (?,?,?,?,?,?,?,?,?,?,?) Parameters: array (
Some more information generated by SHOW ENGINE INNODB STATUS\G; is given below.
*** (1) HOLDS THE LOCK(S):
RECORD LOCKS space id 279 page no 9289 n bits 288 index PRIMARY of table `matomo`.`matomo_log_hsr` trx id 7681918 lock_mode X locks rec but not gap
Record lock, heap no 210 PHYSICAL RECORD: n_fields 15; compact format; info bits 0
0: len 4; hex 00367658; asc 6vX;;
1: len 6; hex 00000075377e; asc u7~;;
2: len 7; hex 01000003a6048c; asc ;;
3: len 4; hex 0000004c; asc L;;
4: len 8; hex 000000000071563b; asc qV;;;
5: len 6; hex 42586d5a796b; asc BXmZyk;;
6: len 6; hex 51463676534f; asc QF6vSO;;
7: len 4; hex 000fb3d2; asc ;;
8: len 1; hex 81; asc ;;
9: len 5; hex 99ae9c74b3; asc t ;;
10: len 3; hex 019aeb; asc ;;
11: len 2; hex 0556; asc V;;
12: len 2; hex 0291; asc ;;
13: len 2; hex 03e8; asc ;;
14: len 2; hex 0322; asc ";;
*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 283 page no 140188 n bits 232 index PRIMARY of table `matomo`.`matomo_log_link_visit_action` trx id 7681918 lock_mode X insert intention waiting
Record lock, heap no 1 PHYSICAL RECORD: n_fields 1; compact format; info bits 0
0: len 8; hex 73757072656d756d; asc supremum;;
*** (2) TRANSACTION:
TRANSACTION 351844404565568, ACTIVE 89 sec fetching rows
mysql tables in use 11, locked 11
LOCK WAIT 209360 lock struct(s), heap size 24404088, 24329330 row lock(s)
MySQL thread id 3838280, OS thread handle 70389417738336, query id 361837446 event_scheduler executing
INSERT INTO materialized_visitors_view (
SELECT
mlv.idvisit,
mlv.idsite,
INET6_NTOA(mlv.location_ip) as ip_address,
mlv.location_city,
mlv.location_country,
mlv.location_region,
mlv.visit_first_action_time,
mlv.config_os,
mlv.config_browser_name,
mlv.config_device_type,
ms.main_url,
mlv.referer_name,
mlv.referer_url,
CASE
WHEN mlv.referer_type = 1 THEN 'Direct Entry'
WHEN mlv.referer_type = 2 THEN 'Search Engine'
WHEN mlv.referer_type = 3 THEN 'Website Refferal'
WHEN mlv.referer_type = 6 THEN 'Campaign'
ELSE 'YouTube/Media'
END as referer_type,
mlv.referer_keyword,
mlv.visitor_seconds_since_last,
SEC_TO_TIME(mlv.visit_total_time) as visit_total_time,
visit_total_actions,
page_agg.page_arr,
DATE(mllva.server_time) as server_time,
MAX(sess_rec.ses_rec_link) as ses_rec_link,
MAX(tmu_rec.tmu_rec_link) as tmu_rec_link,
MAX(mllva.server_time) as se
*** (2) HOLDS THE LOCK(S):
RECORD LOCKS space id 283 page no 140188 n bits 232 index PRIMARY of table `matomo`.`matomo_log_link_visit_action` trx id 351844404565568 lock mode S
Record lock, heap no 1 PHYSICAL RECORD: n_fields 1; compact format; info bits