Bug #76473
closedrados/valgrind-leaks: expected valgrind issues and found none
0%
Description
/a/yuriw-2026-05-06_22:39:58-rados-wip-yuri13-testing-2026-05-06-1810-distro-default-trial/196352
2026-05-07T00:01:22.502 INFO:teuthology.orchestra.run.trial028.stderr:real 0m0.041s
2026-05-07T00:01:22.502 INFO:teuthology.orchestra.run.trial028.stderr:user 0m0.131s
2026-05-07T00:01:22.502 INFO:teuthology.orchestra.run.trial028.stderr:sys 0m0.039s
2026-05-07T00:01:22.504 INFO:tasks.ceph:Archiving logs...
2026-05-07T00:01:22.504 DEBUG:teuthology.misc:Transferring archived files from trial028:/var/log/ceph to /home/teuthworker/mnt/teuthology/yuriw-2026-05-06_22:39:58-rados-wip-yuri13-testing-2026-05-06-1810-distro-default-trial/196352/remote/trial028/log
2026-05-07T00:01:22.505 DEBUG:teuthology.orchestra.run.trial028:> sudo tar c -f - -C /var/log/ceph -- .
2026-05-07T00:01:22.660 ERROR:teuthology.run_tasks:Manager failed: ceph
Traceback (most recent call last):
File "/home/teuthworker/src/git.ceph.com_teuthology_e4fdc9cd0bd063b5e14f697632a4c60f2b912a0c/teuthology/run_tasks.py", line 160, in run_tasks
suppress = manager.__exit__(*exc_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/contextlib.py", line 144, in __exit__
next(self.gen)
File "/home/teuthworker/src/github.com_ceph_ceph-c_d206f563938294e4523af54e1d3ab6091dad9885/qa/tasks/ceph.py", line 2001, in task
with contextutil.nested(*subtasks):
File "/usr/lib/python3.12/contextlib.py", line 144, in __exit__
next(self.gen)
File "/home/teuthworker/src/git.ceph.com_teuthology_e4fdc9cd0bd063b5e14f697632a4c60f2b912a0c/teuthology/contextutil.py", line 54, in nested
raise exc[1]
File "/home/teuthworker/src/git.ceph.com_teuthology_e4fdc9cd0bd063b5e14f697632a4c60f2b912a0c/teuthology/contextutil.py", line 46, in nested
if exit(*exc):
^^^^^^^^^^
File "/usr/lib/python3.12/contextlib.py", line 144, in __exit__
next(self.gen)
File "/home/teuthworker/src/github.com_ceph_ceph-c_d206f563938294e4523af54e1d3ab6091dad9885/qa/tasks/ceph.py", line 343, in valgrind_post
raise Exception('expected valgrind issues and found none')
Exception: expected valgrind issues and found none
/a/skanta-2026-05-07_03:53:58-rados-wip-bharath15-testing-2026-05-07-0507-distro-default-trial/196900
Both tests failed with "rpm_latest" in the description, which corresponds to Rocky10. This might be distro-specific.
LF Updated by Laura Flores 7 months ago
- Assignee set to Nitzan Mordechai
@Nitzan Mordechai WDYT?
BH Updated by Brad Hubbard 7 months ago
See https://tracker.ceph.com/issues/10328 It worked for ten years :D
We expect a valgrind report because we are running this as part of the test (which is running under valgrind).
- exec:
mon.a:
- ceph tell osd.0 leak_some_memory
Which should indeed leak some memory :)
#pragma GCC push_options
#pragma GCC optimize ("O0")
static void leak_some_memory() {
volatile char *foo = new char[1234];
(void)foo;
}
#pragma GCC pop_options
int CephContext::_do_command(
std::string_view command, const cmdmap_t& cmdmap,
Formatter *f,
std::ostream& ss,
bufferlist *out)
{
int r = 0;
lgeneric_dout(this, 1) << "do_command '" << command << "' '" << cmdmap << "'"
»·······»·······»······· << dendl;
ceph_assert_always(!(command == "assert" && _conf->debug_asok_assert_abort));
if (command == "abort") {
if (_conf->debug_asok_assert_abort) {
ceph_abort();
} else {
return -EPERM;
}
}
if (command == "leak_some_memory") {
leak_some_memory();
}
Testing this...
BH Updated by Brad Hubbard 7 months ago
I can reproduce this at will and if I change...
- ceph tell osd.0 leak_some_memory
to...
- ceph tell mon.a leak_some_memory
In the config it passes. This is probably the suppressions or some timing issue I suspect.
@Nitzan Mordechai you can probably assign this to me mate as I reckon I should be able to work it out.
LF Updated by Laura Flores 7 months ago
- Assignee changed from Nitzan Mordechai to Brad Hubbard
Thanks for looking into this Brad!
NM Updated by Nitzan Mordechai 7 months ago
/a/skanta-2026-05-07_14:11:34-rados-wip-bharath15-testing-2026-05-07-0507-distro-default-trial/197895
NM Updated by Nitzan Mordechai 7 months ago
@Brad Hubbard i wonder if it is related to rocky10 compiler difference (we had something similer with leak_some_memory in the past)
RZ Updated by Radoslaw Zarzynski 7 months ago
- Status changed from New to In Progress
BH Updated by Brad Hubbard 7 months ago
@Laura Flores yw!
@Nitzan Mordechai good thinking mate.
In main it fails per https://pulpito.ceph.com/bhubbard-2026-05-12_02:47:23-rados-main-distro-default-trial/
In tentacle it passes per https://pulpito.ceph.com/bhubbard-2026-05-12_03:08:22-rados-tentacle-distro-default-trial/
The main and tentacle binaries used in the tests were compiled with the same compiler (GCC 14.3.1) but they were compiled with different standards, C++20 in the case of tentacle and C++23 in the case of main.
$ readelf --debug-dump=info ./usr/lib/debug/usr/lib64/ceph/libceph-common.so.2-20.2.1-575.g67b62888.el10.x86_64.debug |grep -i producer|grep std|head -1
<2512bfb> DW_AT_producer : (indirect string, offset: 0x109d80): GNU C++20 14.3.1 20250617 (Red Hat 14.3.1-2) -m64 -march=x86-64-v3 -mtune=generic -mtls-dialect=gnu2 -g -g -O2 -O2 -std=c++20 -flto -ffat-lto-objects -fexceptions -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection=full -fPIC -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -fno-strict-aliasing -fsigned-char -ftemplate-depth=1024 -fstack-protector-strong
$
$ readelf --debug-dump=info ./usr/lib/debug/usr/lib64/ceph/libceph-common.so.2-21.0.0-1259.g8e5014f3.el10.x86_64.debug |grep -i producer|grep std|head -1
<24e4f60> DW_AT_producer : (indirect string, offset: 0x700cc): GNU C++23 14.3.1 20250617 (Red Hat 14.3.1-2) -m64 -march=x86-64-v3 -mtune=generic -mtls-dialect=gnu2 -g -g -O2 -O2 -std=c++23 -flto -ffat-lto-objects -fexceptions -fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection=full -fPIC -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -fno-strict-aliasing -fsigned-char -ftemplate-depth=1024 -fstack-protector-strong
I shall endeavor to carry on with this tomorrow.
NM Updated by Nitzan Mordechai 7 months ago
@Brad Hubbard Thanks for taking it! any chance ceph-osd and ceph-mon also have difference flags that causing that?
i saw ceph-mon did cause leaks, but ceph-osd didn't
i thought that maybe something changed in ceph-osd tell, but it looks like the command sent and (i think) osd run that function
BH Updated by Brad Hubbard 7 months ago
Will report back in a couple of days, I think I have a strategy to track this down now.
NM Updated by Nitzan Mordechai 7 months ago
/a/skanta-2026-05-12_11:16:42-rados-wip-bharath18-testing-2026-05-12-0450-distro-default-trial/
['208777']
KS Updated by Kamoltat (Junior) Sirivadhna 7 months ago
bug scrub: bump up
BH Updated by Brad Hubbard 7 months ago
I created the following patch to see if it would help narrow this down (recommend we keep this).
diff --git a/src/common/ceph_context.cc b/src/common/ceph_context.cc
index afd22f86543..11c450db2e2 100644
--- a/src/common/ceph_context.cc
+++ b/src/common/ceph_context.cc
@@ -514,7 +514,8 @@ int CephContext::do_command(std::string_view command, const cmdmap_t& cmdmap,
#pragma GCC push_options
#pragma GCC optimize ("O0")
-static void leak_some_memory() {
+static void leak_some_memory(CephContext* cc) {
+ lgeneric_derr(cc) << "Leaking some memory" << dendl;
volatile char *foo = new char[1234];
(void)foo;
}
@@ -538,7 +539,7 @@ int CephContext::_do_command(
}
}
if (command == "leak_some_memory") {
- leak_some_memory();
+ leak_some_memory(this);
}
else if (command == "perfcounters_dump" || command == "1" ||
command == "perf dump") {
Running the test with the patched version shows the following output when the test is done on the monitor and passes.
2026-05-20T22:05:09.761 DEBUG:teuthology.orchestra.run.trial081:> sudo TESTDIR=/home/ubuntu/cephtest bash -c 'ceph tell mon.a leak_some_memory' 2026-05-20T22:05:09.908 INFO:tasks.ceph.mon.a.trial081.stderr:2026-05-20T22:05:09.905+0000 9b746c0 -1 Leaking some memory ... 2026-05-20T22:06:21.353 DEBUG:tasks.ceph:valgrind exception message: valgrind error: Leak_DefinitelyLost operator new[](unsigned long) ceph::common::leak_some_memory(ceph::common::CephContext*) [clone .lto_priv.0]
And the following output on the osd where it fails.
2026-05-20T22:41:02.539 DEBUG:teuthology.orchestra.run.trial081:> sudo TESTDIR=/home/ubuntu/cephtest bash -c 'ceph tell osd.0 leak_some_memory' 2026-05-20T22:41:02.672 INFO:tasks.ceph.osd.0.trial081.stderr:2026-05-20T22:41:02.672+0000 a6f16c0 -1 Leaking some memory
So this is not a question of the leak_some_memory() function being optimised away or not running for some other reason.
Moving on.
BH Updated by Brad Hubbard 6 months ago
If I zero out qa/valgrind.supp we get the desired output so this is definitely one of the suppressions interfering.
<error>
<unique>0x205c</unique>
<tid>1</tid>
<kind>Leak_DefinitelyLost</kind>
<xwhat>
<text>1,234 bytes in 1 blocks are definitely lost in loss record 883 of 921</text>
<leakedbytes>1234</leakedbytes>
<leakedblocks>1</leakedblocks>
</xwhat>
<stack>
<frame>
<ip>0x614A782</ip>
<obj>/usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so</obj>
<fn>operator new[](unsigned long)</fn>
<dir>/builddir/build/BUILD/valgrind-3.25.1/coregrind/m_replacemalloc</dir>
<file>vg_replace_malloc.c</file>
<line>729</line>
</frame>
<frame>
<ip>0x4B878C0</ip>
<obj>/usr/bin/ceph-osd-classic</obj>
<fn>ceph::common::leak_some_memory(ceph::common::CephContext*)</fn>
<dir>/usr/src/debug/ceph-21.0.0-1568.ga2427701.el10.x86_64/src/common</dir>
<file>ceph_context.cc</file>
<line>519</line>
</frame>
NM Updated by Nitzan Mordechai 6 months ago
/a/skanta-2026-05-26_00:44:20-rados-wip-bharath17-testing-2026-05-25-1331-distro-default-trial/237412
LF Updated by Laura Flores 6 months ago
Bump up
LF Updated by Laura Flores 6 months ago
/a/skanta-2026-05-27_06:21:57-rados-wip-bharath4-testing-2026-05-27-1003-distro-default-trial/240030
BH Updated by Brad Hubbard 6 months ago · Edited
So it's this one on lines 834-841.
834 {
835 ignore *all* ceph-mgr python crap. this is overkill, but better than nothing
836 Memcheck:Leak
837 match-leak-kinds: all
838 ...
839 fun:UnknownInlinedFun
840 ...
841 }
The compiler for rocky I guess is more aggressive and inlining the memory leak function.
This was added recently as a result of https://tracker.ceph.com/issues/72938
Any ideas on how we want to approach this? That suppression is obviously too broad and will catch any type of leak on any stack with any UnknownInlinedFun in it.
@Steven Zuraski are you able to provide any information on what specific stacks this was meant to suppress so we can narrow it down a bit? Also, it has exactly the same description as the suppression preceding it in the file so we should probably change that to differentiate them better as well.
SZ Updated by Steven Zuraski 6 months ago
Hey all, it looks like this was a result of suppressions I had added for inlined functions that Valgrind cannot access the original function name of, I falsely came to the conclusion that these were CPython functions that were inlined and unable to be named, when really the visible stack around the instances were lttng startup frames and glibc loader frames. These leak stacks involving lttng/glibc also contain an unresolved inline frame that valgrind prints as UnknownInlinedFun. I had ran valgrind with --gen-suppressions=all, giving overly literal suppressions, which I then generalized, creating this issue.
I've been digging into more specific valgrind suppressions that fit the needs of the tests, these more specific suppressions in this branch should suffice: https://github.com/ceph/ceph/compare/main...stzuraski898:ceph:wip-sz-76473-valgrindsupp-mgr-fix
I ran the unit tests in src/test/mgr/ under valgrind with these updated suppressions to confirm that they do suppress the leaks. Also for more information, Python 3.14.2 does introduce compiler changes that impacts valgrind output, which I noticed when using my new machine (which is on Fedora 43) after previously running the tests before the lab migration.
BH Updated by Brad Hubbard 6 months ago
I cloned your branch, built it and ran the following test that this tracker is based around.
I'm satisfied your branch resolves this tracker so please add a "Fixes:" line to the relevant commit and thanks for the quick and positive response.
BH Updated by Brad Hubbard 6 months ago
Actually, since I'm changing this code anyway to allow for logging, I'm just going to prevent the compiler from inlining this function since it hardly needs to be performant and we want it clear which function is being called and when. Please continue on with your work on your branch as it is important to qualify these suppressions as best we can to avoid the sort of overlap we see in this case.
SZ Updated by Steven Zuraski 6 months ago
I've updated the commit, happy to help and apologies for the trouble!
LF Updated by Laura Flores 6 months ago
Note from bug scrub: Attach the PR when you're ready for review!
BS Updated by Bill Scales 6 months ago
/a/yuriw-2026-05-26_20:12:02-rados-wip-yuri10-testing-20260526.155424-main-distro-default-trial/238742
/a/yuriw-2026-05-26_23:16:45-rados-wip-yuri10-testing-20260526.155424-main-distro-default-trial/239092
BH Updated by Brad Hubbard 6 months ago
Have a patch, doing final testing.
BH Updated by Brad Hubbard 6 months ago
- Status changed from In Progress to Fix Under Review
- Pull request ID set to 69278
AM Updated by Aishwarya Mathuria 6 months ago
/a/skanta-2026-06-02_04:58:02-rados-wip-bharath3-testing-2026-06-02-0837-distro-default-trial/253576
SS Updated by Sridhar Seshasayee 6 months ago
/a/sseshasa-2026-05-26_18:29:48-rados-wip-sseshasa-testing-2026-05-26-1779803771-distro-default-trial/238445
SZ Updated by Steven Zuraski 6 months ago
- Related to Bug #77138: qa/valgrind.supp has overly broad UnknownInlinedFun suppression added
RZ Updated by Radoslaw Zarzynski 6 months ago
Reviewed.
SS Updated by Sridhar Seshasayee 6 months ago
/a/skanta-2026-06-04_15:14:33-rados-wip-bharath7-testing-2026-06-04-1630-distro-default-trial/265651
CF Updated by Connor Fawcett 6 months ago
/a/skanta-2026-06-04_09:53:35-rados-wip-bharath5-testing-2026-06-02-1032-distro-default-trial/263896
SS Updated by Sridhar Seshasayee 6 months ago
/a/skanta-2026-06-14_23:24:50-rados-wip-bharath11-testing-2026-06-12-0509-distro-default-trial/293728
RZ Updated by Radoslaw Zarzynski 6 months ago
The still awaits QA.
AM Updated by Aishwarya Mathuria 6 months ago
/a/skanta-2026-06-15_22:17:34-rados-wip-bharath12-testing-2026-06-15-1114-distro-default-trial/294602
LF Updated by Laura Flores 5 months ago
The "core" label was missing on the PR, so I have added it. It should be picked up in a batch now.
CF Updated by Connor Fawcett 5 months ago
/a/skanta-2026-06-17_03:50:08-rados-wip-yuri7-testing-2026-06-16-0346-distro-default-trial/296727
LF Updated by Laura Flores 5 months ago
- Backport set to tentacle,umbrella
/a/yuriw-2026-06-23_14:11:44-rados-wip-yuri11-testing-20260622.225138-umbrella-distro-default-trial/310569
LF Updated by Laura Flores 5 months ago
/a/lflores-2026-06-25_15:37:19-rados-wip-lflores-testing-4-2026-06-24-1644-umbrella-distro-default-trial/317066
LS Updated by Lee Sanders 5 months ago
/a/skanta-2026-06-09_02:42:07-rados-wip-bharath2-testing-2026-06-09-0416-distro-default-trial/280701
BH Updated by Brad Hubbard 5 months ago
- Status changed from Fix Under Review to Pending Backport
UB Updated by Upkeep Bot 5 months ago
- Merge Commit set to 54de613cddd2d9c5cf209606ca67229997359e4b
- Fixed In set to v21.3.0-536-g54de613cdd
- Upkeep Timestamp set to 2026-06-30T01:27:24+00:00
UB Updated by Upkeep Bot 5 months ago
- Copied to Backport #77798: tentacle: rados/valgrind-leaks: expected valgrind issues and found none added
UB Updated by Upkeep Bot 5 months ago
- Copied to Backport #77799: umbrella: rados/valgrind-leaks: expected valgrind issues and found none added
UB Updated by Upkeep Bot 5 months ago
- Tags (freeform) set to backport_processed
LF Updated by Laura Flores 5 months ago · Edited
SS Updated by Sridhar Seshasayee 5 months ago
/a/skanta-2026-06-30_08:55:20-rados-wip-bharath20-testing-2026-06-30-1029-umbrella-distro-default-trial/327514
NM Updated by Nitzan Mordechai 4 months ago
/a/skanta-2026-07-30_02:02:55-rados-wip-bharath5-testing-20260729.075206-umbrella-distro-default-trial/411999
JB Updated by Jonathan Bailey 4 months ago
/a/yuriw-2026-07-22_00:55:43-rados-wip-yuri8-testing-20260721.164157-umbrella-distro-default-trial/384312
/a/yuriw-2026-07-22_14:51:00-rados-wip-yuri8-testing-20260721.164157-umbrella-distro-default-trial/386966
BH Updated by Brad Hubbard 4 months ago
LF Updated by Laura Flores 4 months ago
/a/yuriw-2026-07-24_14:18:54-rados-wip-yuri15-testing-20260723.210930-umbrella-distro-default-trial/397242
(This did not include the umbrella backport)
CF Updated by Connor Fawcett 4 months ago
This tracker appeared at 8th on the top 10 failures this week (4 failures found):
Example failure:
/a/yuriw-2026-08-04_13:05:43-rados-wip-yuri8-testing-20260803.202233-umbrella-distro-default-trial/429628/teuthology.log
This run was pre-backport, hopefully it falls off the list next week.
UB Updated by Upkeep Bot 3 months ago
- Status changed from Pending Backport to Resolved
- Tags (freeform) deleted (
backport_processed) - Upkeep Timestamp changed from 2026-06-30T01:27:24+00:00 to 2026-08-27T18:36:18+00:00