matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.7k stars 2.62k forks source link

[Bug]: still having issues with "Oops… there was a problem during the request. Maybe the server had a temporary issue, ..." #21417

Closed courtens closed 11 months ago

courtens commented 11 months ago

What happened?

I am again having the issue described in my post https://github.com/matomo-org/matomo/issues/19955

I thought I solved it by adding <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> to all my pages (such as described here https://github.com/matomo-org/matomo/issues/18763#issuecomment-1422892547) but that did not stick. Somehow it worked for some time -- but now I have that error back again.

What should happen?

I updated the system to the latest php and implemented Auto-Archiving but the page category=General_Visitors&subcategory=Live_VisitorLog is still producing an error for idSite=2.

image

How can this be reproduced?

I have multiple domain names which use the same code. Based on that I am not thinking that the problem is within the way I send the data matomo.

This is my tracking code used by filmfix.com and filmfix.ch

<script defer type="text/javascript">
    var _paq =  window._paq = window._paq || [];
    _paq.push(["setDocumentTitle","<%= server.URLencode(titleContentHolder) %>"]);
    _paq.push(["setCookieDomain", "*.<%=DomainName%>.<%=ComType %>"]);
    _paq.push(['setCookieSameSite', 'None']);
    _paq.push(["setDomains", "*.<%=DomainName%>.<%=ComType %>"]);<%
    if request.querystring("gfilm") <> "" then %>
        _paq.push(["setCampaignNameKey", "gfilm"]);
        _paq.push(["setCampaignKeywordKey", "8mm"]);<%
    end if 
    %>
    _paq.push(['trackPageView']);
    _paq.push(['enableLinkTracking']);
    (function() {
        var u="https://matomo.<%=DomainName%>.<%=ComType%>/";
        _paq.push(['setTrackerUrl', u+'piwik.php']);
        _paq.push(['setSiteId', '<% call write_site_number() %>']);
        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
        g.type='text/javascript'; g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
    })();
</script>

In matomo reports for idSite=1 (www.filmfix.com) works, but reports for idSite=2 (www.filmfix.ch) are not.

I just discovered that site 2 (which is hosted by a different server) is missing a return header for content-type altogether -- could this be causing the problem? I hope this is it. I really wished matomo would filter out the content that brakes the UI before adding it to the database.

Matomo Version

Matomo 4

Matomo Patch or Minor Version

4.15.1

PHP Version

8.2.9

Server Operating System

Windows

What browsers are you seeing the problem on?

No response

Computer Operating System

Windows

Relevant log output

matomo-archive.log

INFO [2023-10-19 14:41:35] 5612  ---------------------------
INFO [2023-10-19 14:41:35] 5612  INIT
INFO [2023-10-19 14:41:35] 5612  Running Matomo 4.15.1 as Super User
INFO [2023-10-19 14:41:35] 5612  ---------------------------
INFO [2023-10-19 14:41:35] 5612  NOTES
INFO [2023-10-19 14:41:35] 5612  - Async process archiving not supported, using curl requests.
INFO [2023-10-19 14:41:35] 5612  - Reports for today will be processed at most every 3600 seconds. You can change this value in Matomo UI > Settings > General Settings.
INFO [2023-10-19 14:41:35] 5612  - Archiving was last executed without error 59 min 7s ago.
INFO [2023-10-19 14:41:40] 5612  ---------------------------
INFO [2023-10-19 14:41:40] 5612  START
INFO [2023-10-19 14:41:40] 5612  Starting Matomo reports archiving...
INFO [2023-10-19 14:41:45] 5612  Start processing archives for site 1.
INFO [2023-10-19 14:41:45] 5612    Will invalidate archived reports for today in site ID = 1's timezone (2023-10-19 00:00:00).
INFO [2023-10-19 14:41:49] 5612    Will invalidate archived reports for yesterday in site ID = 1's timezone (2023-10-18 00:00:00).
INFO [2023-10-19 14:41:51] 5612  Archived website id 1, period = day, date = 2023-10-19, segment = '', 9 visits found. Time elapsed: 1.111s
INFO [2023-10-19 14:41:51] 5612  Archived website id 1, period = day, date = 2023-10-19, segment = 'actions==1', 8 visits found. Time elapsed: 0.794s
INFO [2023-10-19 14:41:52] 5612  Archived website id 1, period = week, date = 2023-10-16, segment = '', 143 visits found. Time elapsed: 0.889s
INFO [2023-10-19 14:41:53] 5612  Archived website id 1, period = week, date = 2023-10-16, segment = 'actions==1', 124 visits found. Time elapsed: 0.901s
INFO [2023-10-19 14:41:54] 5612  Archived website id 1, period = month, date = 2023-10-01, segment = '', 790 visits found. Time elapsed: 1.062s
INFO [2023-10-19 14:41:55] 5612  Archived website id 1, period = month, date = 2023-10-01, segment = 'actions==1', 672 visits found. Time elapsed: 1.016s
INFO [2023-10-19 14:42:02] 5612  Archived website id 1, period = year, date = 2023-01-01, segment = '', 14876 visits found. Time elapsed: 6.898s
INFO [2023-10-19 14:42:09] 5612  Archived website id 1, period = year, date = 2023-01-01, segment = 'actions==1', 12531 visits found. Time elapsed: 6.540s
INFO [2023-10-19 14:42:09] 5612  Finished archiving for site 1, 8 API requests, Time elapsed: 24.348s [1 / 5 done]
INFO [2023-10-19 14:42:14] 5612  Start processing archives for site 2.
INFO [2023-10-19 14:42:14] 5612    Will invalidate archived reports for today in site ID = 2's timezone (2023-10-19 00:00:00).
INFO [2023-10-19 14:42:14] 5612    Will invalidate archived reports for yesterday in site ID = 2's timezone (2023-10-18 00:00:00).
INFO [2023-10-19 14:42:14] 5612  Archived website id 2, period = day, date = 2023-10-19, segment = '', 8 visits found. Time elapsed: 0.753s
INFO [2023-10-19 14:42:15] 5612  Archived website id 2, period = week, date = 2023-10-16, segment = '', 80 visits found. Time elapsed: 0.893s
INFO [2023-10-19 14:42:16] 5612  Archived website id 2, period = month, date = 2023-10-01, segment = '', 232 visits found. Time elapsed: 0.950s
INFO [2023-10-19 14:42:22] 5612  Archived website id 2, period = year, date = 2023-01-01, segment = '', 4012 visits found. Time elapsed: 6.193s
INFO [2023-10-19 14:42:22] 5612  Finished archiving for site 2, 4 API requests, Time elapsed: 8.884s [2 / 5 done]
INFO [2023-10-19 14:42:27] 5612  Start processing archives for site 3.
INFO [2023-10-19 14:42:27] 5612    Will invalidate archived reports for yesterday in site ID = 3's timezone (2023-10-18 00:00:00).
INFO [2023-10-19 14:42:27] 5612  Finished archiving for site 3, 0 API requests, Time elapsed: 0.012s [3 / 5 done]
INFO [2023-10-19 14:42:32] 5612  Start processing archives for site 4.
INFO [2023-10-19 14:42:32] 5612    Will invalidate archived reports for yesterday in site ID = 4's timezone (2023-10-18 00:00:00).
INFO [2023-10-19 14:42:32] 5612  Finished archiving for site 4, 0 API requests, Time elapsed: 0.012s [4 / 5 done]
INFO [2023-10-19 14:42:37] 5612  Start processing archives for site 5.
INFO [2023-10-19 14:42:37] 5612  Finished archiving for site 5, 0 API requests, Time elapsed: 0.029s [5 / 5 done]
INFO [2023-10-19 14:42:42] 5612  Done archiving!
INFO [2023-10-19 14:42:42] 5612  ---------------------------
INFO [2023-10-19 14:42:42] 5612  SUMMARY
INFO [2023-10-19 14:42:42] 5612  Processed 12 archives.
INFO [2023-10-19 14:42:42] 5612  Total API requests: 12
INFO [2023-10-19 14:42:42] 5612  done: 12 req, 61953 ms, no error
INFO [2023-10-19 14:42:42] 5612  Time elapsed: 61.953s
INFO [2023-10-19 14:42:42] 5612  ---------------------------
INFO [2023-10-19 14:42:42] 5612  SCHEDULED TASKS
INFO [2023-10-19 14:42:42] 5612  Starting Scheduled tasks... 
INFO [2023-10-19 14:42:42] 5612  done
INFO [2023-10-19 14:42:42] 5612  ---------------------------

Validations

bx80 commented 11 months ago

Hi @courtens, thanks for the detailed report, I understand that it must be frustrating to keep encountering this issue :disappointed:

As before it sounds like there may be a problem where characters encoded in an unexpected way are entering the database and causing the Visits Log to fail (the Live Visitors reports don't use archives and read directly from the log data) Adding a <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> header is likely working around this by forcing UTF-8 encoding.

Hopefully adding this to your second site will work around the problem for now.

The underlying issue documented in #18763 still needs to be addressed so I'll close this issue as a duplicate but also request a priority review of #18763 so we can look at scheduling some time on this.

courtens commented 11 months ago

@bx80 Thank you. Something to note: <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> did not work as workaround.

UPDATE: Even after implementing Auto-Archiving for the idSite=2 (filmfix.ch) matomo had problems.

image

bx80 commented 11 months ago

Thanks @courtens, extra information is always helpful when trying to recreate and fix these sort of issues :+1: