Zoltán Borók-Nagy created IMPALA-15860:
------------------------------------------
Summary: Buffer pool livelocks retrying madvise() on EAGAIN when
impalad reaches vm.max_map_count
Key: IMPALA-15860
URL: https://issues.apache.org/jira/browse/IMPALA-15860
Project: IMPALA
Issue Type: Bug
Components: Backend
Reporter: Zoltán Borók-Nagy
SystemAllocator retries madvise(MADV_HUGEPAGE) after each buffer allocation,
and madvise(MADV_NOHUGEPAGE) in Free(), for as long as the call returns EAGAIN
(be/src/runtime/bufferpool/system-allocator.cc, the three "while (rc == -1 &&
errno == EAGAIN)" loops). When the process is at vm.max_map_count, the kernel
cannot split the VMA and reports EAGAIN on every call, so these loops never
end. All allocating threads then spin on the mmap lock and the query makes no
progress.
Example on master: TPC-DS SF10000 q4 with COMPUTE_PROCESSING_COST=true on 4
hosts with mem_limit=120G, THP enabled=madvise and the default
vm.max_map_count=65530. Every impalad reached 65,531 mappings at about 101 GiB
of RSS and stayed there, using 41-44 cores each. perf showed 93% of CPU in
rwsem spinning under madvise() called from SystemAllocator::Allocate() on the
aggregation spill path (BufferedTupleStream::NewWritePage). In 2 seconds on one
host, 3,519,563 of 3,519,564 madvise() calls returned EAGAIN. The query ran
until EXEC_TIME_LIMIT_S expired it after 1 hour; then 3 of the 4 impalads
aborted in the JVM on a failed mmap(), and the coordinator's memory maintenance
thread kept spinning in the Free() loop.
Ask: since MADV_HUGEPAGE and MADV_NOHUGEPAGE are only hints, bound the retries
and continue without them (logging once), so that reaching the mapping limit
fails or degrades instead of hanging. IMPALA-15837 covers the abort at the same
limit.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)