tests: limit memory usage for tests#76388
Conversation
alexey-milovidov
left a comment
There was a problem hiding this comment.
This is great! Can we also set up limits on the number of processes and opened files? (they can be set to a reasonably high value).
|
I guess this make sense as well, though I would not expect them to be huge right now. What I really think make sense is to implement them as cgroups, to limit the memory properly over limiting address space. |
To avoid situation when the tests eats too much RAM and we spend dozen of time to figure out why MEMORY_LIMIT_EXCEEDED happens on the server. Refs: ClickHouse#75966
887a843 to
05a9015
Compare
|
|
||
| def prlimit(command, limit): | ||
| """Limit memory usage for each test to avoid MEMORY_LIMIT_EXCEEDED errors on server""" | ||
| return f"prlimit --as={limit} {command}" |
There was a problem hiding this comment.
There is the --rss option.
There was a problem hiding this comment.
This is rudiment, here is a snippet from man page:
RLIMIT_RSS
Specifies the limit (in pages) of the process's resident set (the number of virtual pages resident in RAM). This limit only has effect in Linux 2.4.x, x < 30, and there only affects calls to [madvise](https://linux.die.net/man/2/madvise)(2) specifying MADV_WILLNEED
| if batch_num and batch_total: | ||
| aux = f"--run-by-hash-total {batch_total} --run-by-hash-num {batch_num-1}" | ||
| statless_test_command = f"clickhouse-test --testname --shard --zookeeper --check-zookeeper-session --hung-check --print-time \ | ||
| statless_test_command = f"clickhouse-test --memory-limit {20<<30} --testname --shard --zookeeper --check-zookeeper-session --hung-check --print-time \ |
There was a problem hiding this comment.
We don't have to expose these settings, hardcoding is ok.
There was a problem hiding this comment.
However, due to the comment above, this is likely to not work with sanitizers, so let's keep it.
|
Dear @azat, this PR hasn't been updated for a while. Will you continue working on it? If not, please close it. Otherwise, ignore this message. |
Jobs with sanitizers shows lots of OOM, last time (ClickHouse#76143) it happened due to some test spawns tons of clients, and sanitizer binary takes 650MiB each in RAM Refs: ClickHouse#82036 Resubmit of: ClickHouse#76388
Jobs with sanitizers shows lots of OOM, last time (ClickHouse#76143) it happened due to some test spawns tons of clients, and sanitizer binary takes 650MiB each in RAM This is resubmit of ClickHouse#76388, which did not work because address space limit, which is way different thing, especially for the binaries built with sanitizers Refs: ClickHouse#82036
Jobs with sanitizers shows lots of OOM, last time (ClickHouse#76143) it happened due to some test spawns tons of clients, and sanitizer binary takes 650MiB each in RAM This is resubmit of ClickHouse#76388, which did not work because address space limit, which is way different thing, especially for the binaries built with sanitizers Refs: ClickHouse#82036
Jobs with sanitizers shows lots of OOM, last time (ClickHouse#76143) it happened due to some test spawns tons of clients, and sanitizer binary takes 650MiB each in RAM This is resubmit of ClickHouse#76388, which did not work because address space limit, which is way different thing, especially for the binaries built with sanitizers Refs: ClickHouse#82036
Jobs with sanitizers shows lots of OOM, last time (ClickHouse#76143) it happened due to some test spawns tons of clients, and sanitizer binary takes 650MiB each in RAM This is resubmit of ClickHouse#76388, which did not work because address space limit, which is way different thing, especially for the binaries built with sanitizers Refs: ClickHouse#82036
Jobs with sanitizers shows lots of OOM, last time (ClickHouse#76143) it happened due to some test spawns tons of clients, and sanitizer binary takes 650MiB each in RAM This is resubmit of ClickHouse#76388, which did not work because address space limit, which is way different thing, especially for the binaries built with sanitizers Refs: ClickHouse#82036
Jobs with sanitizers shows lots of OOM, last time (ClickHouse#76143) it happened due to some test spawns tons of clients, and sanitizer binary takes 650MiB each in RAM This is resubmit of ClickHouse#76388, which did not work because address space limit, which is way different thing, especially for the binaries built with sanitizers Refs: ClickHouse#82036
Jobs with sanitizers shows lots of OOM, last time (ClickHouse#76143) it happened due to some test spawns tons of clients, and sanitizer binary takes 650MiB each in RAM This is resubmit of ClickHouse#76388, which did not work because address space limit, which is way different thing, especially for the binaries built with sanitizers Refs: ClickHouse#82036 v2: use cgroup v2
Jobs with sanitizers shows lots of OOM, last time (ClickHouse#76143) it happened due to some test spawns tons of clients, and sanitizer binary takes 650MiB each in RAM This is resubmit of ClickHouse#76388, which did not work because address space limit, which is way different thing, especially for the binaries built with sanitizers Refs: ClickHouse#82036 v2: use cgroup v2
Jobs with sanitizers shows lots of OOM, last time (ClickHouse#76143) it happened due to some test spawns tons of clients, and sanitizer binary takes 650MiB each in RAM This is resubmit of ClickHouse#76388, which did not work because address space limit, which is way different thing, especially for the binaries built with sanitizers Refs: ClickHouse#82036 v2: use cgroup v2
Note: for now in draft, since likely there will be some issues
To avoid situation when the tests eats too much RAM and we spend dozen of time to figure out why MEMORY_LIMIT_EXCEEDED happens on the server.
Refs: #75966
Changelog category (leave one):