Skip to content

master: keep MaybeTrimHeap buildable on glibc 2.28 (manylinux2_28) - #10

Merged
Juhyun-Kim-Memphis merged 1 commit into
our_mainfrom
vessl/mallinfo2-glibc228
Aug 20, 2026
Merged

Juhyun-Kim-Memphis merged 1 commit into
our_mainfrom
vessl/mallinfo2-glibc228

Conversation

@Juhyun-Kim-Memphis

@Juhyun-Kim-Memphis Juhyun-Kim-Memphis commented Aug 20, 2026 •

Copy link
Copy Markdown
Collaborator

mallinfo2()는 glibc 2.33부터 있다. store 자신의 툴체인(ubuntu 24.04, glibc 2.39)에는 있지만, python wheel을 빌드하는 manylinux2_28 이미지는 glibc 2.28이라 없다. 그래서 이 심볼을 조건 없이 쓰면 실제 빌드 타깃 두 개 중 하나만 컴파일된다.

/src/mooncake-store/src/master_service.cpp:9215:25: error: 'mallinfo2' was not
declared in this scope; did you mean 'mallinfo'?

wheel carrier 빌드에서 실제로 터진 것이고, our_main 현재 상태로는 carrier를 만들 수 없다. 마지막으로 성공한 carrier(a96c1cd5)는 이 코드가 들어오기 전이다.

unittest 게이트가 왜 이걸 못 잡았나

게이트 레시피(Dockerfile.unittest)는 의도적으로 ubuntu:24.04에서 돌고, manylinux 베이스를 공유하지 않는다(gtest 링크 함정 때문). 그래서 게이트는 glibc 2.39 경로만 검증하고, glibc 버전에 의존하는 변경은 게이트를 통과한 뒤 carrier에서 터진다. 이번이 그 사례다. carrier 빌드 자체가 glibc 2.28 컴파일 게이트라는 뜻이기도 하다.

고친 방법

__GLIBC_PREREQ(2, 33)로 호출을 고르고, 네 필드를 size_t로 넓히는 헬퍼 하나(ReadHeapInfo)로 모았다.

이 숫자들은 로그 전용이고 판단에 쓰이지 않는다 — trim 트리거는 /proc을 읽는 ReadResidentBytes()다. 그래서 2.33 미만 경로에서 잃는 것은 정밀도뿐이고, 어디서 잃는지는 주석에 적었다: mallinfo()의 필드는 int라서 힙이 2 GiB를 넘으면 wrap하는데, 그게 바로 이 코드가 존재하는 크기 영역이다.

검증

  • glibc 2.39 경로: unittest 게이트(4 suite / 107 테스트)가 이 파일을 컴파일하며 통과 — 다만 그것은 이 변경 이전 상태에서 통과한 것이고, 이 변경 후 게이트 재실행이 필요하다.
  • glibc 2.28 경로: wheel carrier 빌드가 이 커밋에서 컴파일되는지가 판정이다. 이 PR 시점에는 미검증.
  • 로컬 컴파일은 하지 않았다(ylt/boost 헤더 체인이 필요).

mallinfo2() is glibc >= 2.33. The store's own toolchain (ubuntu 24.04,
glibc 2.39) has it; the manylinux2_28 image that builds the python wheel is
glibc 2.28 and does not, so naming it unconditionally compiles on one real
build target and fails on the other:

  master_service.cpp:9215:25: error: 'mallinfo2' was not declared in this
  scope; did you mean 'mallinfo'?

Select the call behind __GLIBC_PREREQ(2, 33) and widen the four fields to
size_t in one helper. These numbers are logged and never decided on -- the
trim trigger reads /proc via ReadResidentBytes() -- so the pre-2.33 path
costs only precision, and the comment says where: mallinfo()'s fields are
int and wrap above 2 GiB, which is the range this code exists for.
@Juhyun-Kim-Memphis Juhyun-Kim-Memphis self-assigned this Aug 20, 2026
@Juhyun-Kim-Memphis
Juhyun-Kim-Memphis marked this pull request as ready for review August 20, 2026 16:57
@Juhyun-Kim-Memphis
Juhyun-Kim-Memphis merged commit 5131049 into our_main Aug 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant