Skip to content

MemoryTracker wrong total: Memory limit (total) exceeded, but no real usage #15932

@Amberon

Description

@Amberon

Simple SELECT query leads to Memory limit (total) exceeded due to wrong reporting by MemoryTracker (no real usage detected in top)

I execute a simple query (select a from b where c = 1) in one thread sequentially via HTTP:

for i in `seq 1 500`; do curl "http://ch:8123/?query=SELECT%20a%20FROM%20%60db%60.b%20WHERE%20c%3D1%20format%20JSON"; done;

It leads to this error in 15 seconds
DB data ~200mb compressed.
It consumes ~4MB per request and accumulates up to the 3.6GB limit. I see a continuous growth in MemoryTracker, which, if you do not stop the requests (or switch to other request), will not be reset.
But there is no real growth in the top.
Result contains 0 rows if it matters
Version 20.9.2.20 stable, in 20.6 and 20.8 it was the same.

Changing config max_server_memory_usage_to_ram_ratio is a dirty fix

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed user-visible misbehaviour in official releasememoryWhen memory usage is higher than expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions