plausible / analytics

Simple, open source, lightweight (< 1 KB) and privacy-friendly web analytics alternative to Google Analytics.
https://plausible.io
GNU Affero General Public License v3.0
18.98k stars 1.02k forks source link

Can't view stats for a longish time range #4257

Open jonahgreenthal opened 2 weeks ago

jonahgreenthal commented 2 weeks ago

Past Issues Searched

Issue is a Bug Report

Using official Plausible Cloud hosting or self-hosting?

Self-hosting

Describe the bug

When I try to view page stats for a time range longer than about six months, the page spins seemingly indefinitely (even overnight) without actually producing data.

This instance is self-hosted on a t2.micro EC2 instance. One possibility is that calculating the aggregation is too resource-intensive, though top shows that there is plenty of available memory (and even more available swap space). If that is the issue, though, there should at least be a reasonable error message, though realistically, I'd be comfortable waiting (just not indefinitely).

I would be happy to do additional work to try to narrow this down, troubleshoot, etc. However, I do not know anything about Plausible internals.

Expected behavior

The report for the indicated time range should load, preferably in a reasonable amount of time.

Screenshots

image

Environment

- OS: Windows 10
- Browser: Firefox
- Browser Version: 127.0
ruslandoga commented 2 weeks ago

👋 @jonahgreenthal

Thank you for the report!

According to the browser console the query times out after ten seconds. You might get more info (which query, where in the code, etc.) from the server logs:

$ cd hosting # or wherever you cloned plausible/community-edition
$ docker compose logs

There are two possible improvements:

jonahgreenthal commented 1 week ago

Thanks! Here's what I see in the logs:

plausible_plausible_events_db_1  | 2024.06.21 13:07:38.363143 [ 328 ] {58dfd4a2-fe00-4cec-a90c-90d9d45f3a49} <Error> DynamicQueryHandler: Cannot send exception to client: Code: 24. DB::Exception: Cannot write to ostream at offset 712. (CANNOT_WRITE_TO_OSTREAM), Stack trace (when copying this message, always include the lines below):
plausible_plausible_events_db_1  | 
plausible_plausible_events_db_1  | 0. DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, bool) @ 0xa3fb75a in /usr/bin/clickhouse
plausible_plausible_events_db_1  | 1. DB::WriteBufferFromOStream::nextImpl() @ 0xa533d12 in /usr/bin/clickhouse
plausible_plausible_events_db_1  | 2. DB::WriteBufferFromHTTPServerResponse::nextImpl() @ 0x15cb32ec in /usr/bin/clickhouse
plausible_plausible_events_db_1  | 3. DB::HTTPHandler::trySendExceptionToClient(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, DB::HTTPServerRequest&, DB::HTTPServerResponse&, DB::HTTPHandler::Output&) @ 0x15c2f8bf in /usr/bin/clickhouse
plausible_plausible_events_db_1  | 4. DB::HTTPHandler::handleRequest(DB::HTTPServerRequest&, DB::HTTPServerResponse&) @ 0x15c30e84 in /usr/bin/clickhouse
plausible_plausible_events_db_1  | 5. DB::HTTPServerConnection::run() @ 0x15cabda2 in /usr/bin/clickhouse
plausible_plausible_events_db_1  | 6. Poco::Net::TCPServerConnection::start() @ 0x18a16b73 in /usr/bin/clickhouse
plausible_plausible_events_db_1  | 7. Poco::Net::TCPServerDispatcher::run() @ 0x18a17ecd in /usr/bin/clickhouse
plausible_plausible_events_db_1  | 8. Poco::PooledThread::run() @ 0x18bda829 in /usr/bin/clickhouse
plausible_plausible_events_db_1  | 9. Poco::ThreadImpl::runnableEntry(void*) @ 0x18bd80e2 in /usr/bin/clickhouse
plausible_plausible_events_db_1  | 10. ? @ 0x73541dca5609 in ?
plausible_plausible_events_db_1  | 11. __clone @ 0x73541dbca133 in ?
plausible_plausible_events_db_1  |  (version 22.8.13.20 (official build))
plausible_plausible_events_db_1  | 2024.06.21 13:07:38.366146 [ 328 ] {} <Error> ServerErrorHandler: Poco::Exception. Code: 1000, e.code() = 32, I/O error: Broken pipe, Stack trace (when copying this message, always include the lines below):
plausible_plausible_events_db_1  | 
plausible_plausible_events_db_1  | 0. Poco::Net::SocketImpl::error(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x18a0f921 in /usr/bin/clickhouse
plausible_plausible_events_db_1  | 1. Poco::Net::SocketImpl::sendBytes(void const*, int, int) @ 0x18a11306 in /usr/bin/clickhouse
plausible_plausible_events_db_1  | 2. Poco::Net::StreamSocketImpl::sendBytes(void const*, int, int) @ 0x18a15a77 in /usr/bin/clickhouse
plausible_plausible_events_db_1  | 3. Poco::Net::HTTPSession::write(char const*, long) @ 0x189ef053 in /usr/bin/clickhouse
plausible_plausible_events_db_1  | 4. Poco::Net::HTTPChunkedStreamBuf::writeToDevice(char const*, long) @ 0x189d9715 in /usr/bin/clickhouse
plausible_plausible_events_db_1  | 5. Poco::BasicBufferedStreamBuf<char, std::__1::char_traits<char>, Poco::Net::HTTPBufferAllocator>::sync() @ 0x189da829 in /usr/bin/clickhouse
plausible_plausible_events_db_1  | 6. ? @ 0x189d992b in /usr/bin/clickhouse
plausible_plausible_events_db_1  | 7. Poco::Net::HTTPChunkedOutputStream::~HTTPChunkedOutputStream() @ 0x189da4e2 in /usr/bin/clickhouse
plausible_plausible_events_db_1  | 8. DB::HTTPServerConnection::run() @ 0x15cabf33 in /usr/bin/clickhouse
plausible_plausible_events_db_1  | 9. Poco::Net::TCPServerConnection::start() @ 0x18a16b73 in /usr/bin/clickhouse
plausible_plausible_events_db_1  | 10. Poco::Net::TCPServerDispatcher::run() @ 0x18a17ecd in /usr/bin/clickhouse
plausible_plausible_events_db_1  | 11. Poco::PooledThread::run() @ 0x18bda829 in /usr/bin/clickhouse
plausible_plausible_events_db_1  | 12. Poco::ThreadImpl::runnableEntry(void*) @ 0x18bd80e2 in /usr/bin/clickhouse
plausible_plausible_events_db_1  | 13. ? @ 0x73541dca5609 in ?
plausible_plausible_events_db_1  | 14. __clone @ 0x73541dbca133 in ?
plausible_plausible_events_db_1  |  (version 22.8.13.20 (official build))

Of the options you say, I'd definitely prefer one that lets me see the info rather than an error :-)