Repository navigation
rgw: declare rgw_a's dependency on heap_profiler - #71481
Conversation
6d8851a added the tcmalloc heap profiler hook to rgw_appmain.cc, which is part of rgw_a, but only declared the heap_profiler dependency on radosgw, the rgw shared library and rgw_a_standalone. rgw_a itself never declared it, so every other consumer of rgw_a depends on the linker not extracting rgw_appmain.cc.o. ld.bfd hides this via lazy archive extraction. mold resolves COMDAT symbols to the earliest archive member on the command line, so a std::string::front() reference from libarrow.a pulls librgw_a.a(rgw_file) -> rgw_lib -> rgw_appmain into radosgw-admin, which then fails with undefined ceph_heap_profiler_init(), ceph_using_tcmalloc() and ceph_heap_profiler_handle_command(). Any rgw_a consumer (radosgw-es, rgw-policy-*, denc-mod-rgw, the rgw unit tests) can fail the same way. Declare heap_profiler on rgw_a (PRIVATE), matching rgw_a_standalone, and drop the now redundant explicit links from radosgw and the rgw shared library. Fixes: 6d8851a Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01E63tgb7eXHwzmaQBSErFWu Signed-off-by: Andrew Altshuler <[email protected]>
|
Thank you for your contribution. Since you are not yet a member of the Ceph organization with write permissions on ceph/ceph.git, our CI will not automatically run. Any member of the Ceph organization may label this PR |
|
@aaltshuler can you please add the PR checklist to the main comment: Checklist
|
|
@yuvalif checklist added (Verify Checklist is green now); make check passed on x86 and arm64. Ready for review whenever convenient. @mkogan1 flagging you as the merger of #67446, which this fixes — it declares the |
|
@aaltshuler thanks for you contribution! |
|
Thanks — yes, #70307's The only extra here is dropping the now-redundant explicit |
mkogan1
left a comment
There was a problem hiding this comment.
@mkogan1 flagging you as the merger of #67446, which this fixes — it declares the
heap_profilerdependency onrgw_awherergw_appmain.ccuses it, so mold-linked builds ofradosgw-admin(and the otherrgw_aconsumers) link again; GNU ld only masked it via lazy archive extraction.
Thanks, was able to repro the link failure to check the fix:
on current main:
❯ glo | head
481c3130957 (origin/main, origin/HEAD) Merge pull request #71761 from tchaikov/wip-test-seastore-looku
❯ ./do_cmake.sh -DWITH_MOLD=ON -DALLOCATOR=tcmalloc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_MGR_DASHBOARD_FRONTEND=OFF -DWITH_TESTS=OFF
❯ cmake --build ./build --parallel $(nproc --ignore=1) --verbose
...
mold: error: undefined symbol: ceph_using_tcmalloc()
...
after cherry-pick of this PR commiit
❯ git cherry-pick -ex b0e20b08e1a5732437a761ee3bd9d56bb4fee7b2
it builds and the tcmalloc heap stats work:
❯ sudo ./bin/ceph daemon 'client.rgw.8000' heap stats
client.rgw.8000 tcmalloc heap stats:------------------------------------------------
MALLOC: 55560512 ( 53.0 MiB) Bytes in use by application
MALLOC: + 491520 ( 0.5 MiB) Bytes in page heap freelist
MALLOC: + 385376 ( 0.4 MiB) Bytes in central cache freelist
MALLOC: + 3570176 ( 3.4 MiB) Bytes in transfer cache freelist
MALLOC: + 2489184 ( 2.4 MiB) Bytes in thread cache freelists
MALLOC: + 2883584 ( 2.8 MiB) Bytes in malloc metadata
MALLOC: ------------
MALLOC: = 65380352 ( 62.4 MiB) Actual memory used (physical + swap)
MALLOC: + 0 ( 0.0 MiB) Bytes released to OS (aka unmapped)
MALLOC: ------------
MALLOC: = 65380352 ( 62.4 MiB) Virtual address space used
MALLOC:
MALLOC: 916 Spans in use
MALLOC: 82 Thread heaps in use
MALLOC: 8192 Tcmalloc page size
------------------------------------------------
Call ReleaseFreeMemory() to release freelist memory to the OS (via madvise()).
Bytes released to the OS take up virtual address space but no physical memory.
|
This PR has been added to main integration testing by anuchaithra started 2026-09-17-04:59. |
Testing completed and got approval from @ivancich, morr details in https://tracker.ceph.com/issues/80592). |
Building
main(andwip-s3vector, which is rebased on it) with-DWITH_MOLD=ONfails to linkradosgw-admin:Root cause: 6d8851a (#67446) made
rgw_appmain.cc— a member ofrgw_a— call the heap profiler, but declaredheap_profileronly onradosgw,rgw(librgw) andrgw_a_standalone, never onrgw_a.radosgw-admindoes not useAppMain; mold pulls the object in anywaythrough archive resolution. Replaying the link with
-Wl,-y:The identical link command with
-fuse-ld=bfdsucceeds (lazy extractionnever touches
rgw_appmain.o), which is why CI does not see it.This declares the dependency on the library whose translation unit uses
it — the pattern kv/mon/osd/mds/bluestore already follow, and the same fix
shape as 056b706 ("rgw: declare rgw_a's dependency on rgw_schedulers
and kmip") — and drops the now-redundant explicit links.
Consequences: under tcmalloc builds,
rgw_a-linking tools gain alibtcmalloc.so.4runtime dependency (radosgw-admin, rgw-policy-check/-test, radosgw-es, radosgw-object-expirer, denc-mod-rgw); packaging picks
it up automatically, as it already does for rgw-standalone-admin. Under
ALLOCATOR=libcthe stub archive has no dependencies. Note that6d8851a also re-linked librgw.so against tcmalloc (cf. c4b4ba5 /
tracker 63394); this change leaves librgw as it is today.
Verified: Ubuntu 24.04 aarch64, gcc-14, mold 2.41.0, Debug, tcmalloc —
radosgw-admin, radosgw, radosgw-es, radosgw-object-expirer,
rgw-policy-check and rgw-policy-test link;
ceph_heap_profiler_initisdefined in each; vstart
radosgw-admin user listworks.🤖 Generated with Claude Code
https://claude.ai/code/session_01E63tgb7eXHwzmaQBSErFWu
Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windowsjenkins test rook e2e