analytics icon indicating copy to clipboard operation
analytics copied to clipboard

Can't view stats for a longish time range

Open jonahgreenthal opened this issue 1 year ago • 2 comments

Past Issues Searched

  • [X] I have searched open and closed issues to make sure that the bug has not yet been reported

Issue is a Bug Report

  • [X] This is a bug report and not a feature request, nor asking for self-hosted support

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

jonahgreenthal avatar Jun 21 '24 03:06 jonahgreenthal

👋 @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:

  • make timeout configurable or remove it completely in the community edition
  • show an error in UI and stop the spinning wheel

ruslandoga avatar Jun 21 '24 06:06 ruslandoga

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 :-)

jonahgreenthal avatar Jun 21 '24 13:06 jonahgreenthal

👋 @jonahgreenthal

A way to increase task timeout value https://github.com/plausible/analytics/pull/4494 has been released in v2.1.2: https://github.com/plausible/analytics/discussions/4618

To increase the timeout value, you would need to add it in the query string to CLICKHOUSE_DATABASE_URL like in https://github.com/plausible/analytics/discussions/3311#discussioncomment-6891268

ruslandoga avatar Sep 25 '24 12:09 ruslandoga

Thank you! I think it's working, but I'm not totally sure because I no longer remember exactly what operation I was trying to do befor :-/

jonahgreenthal avatar Sep 27 '24 03:09 jonahgreenthal

I'm going to close it then since another user reported that the task timeout workaround is working in https://github.com/plausible/analytics/discussions/4360#discussioncomment-10770489 :)

ruslandoga avatar Sep 27 '24 10:09 ruslandoga