all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: "Kefu Chai" <k.chai@proxmox.com>
To: "Fiona Ebner" <f.ebner@proxmox.com>, <pve-devel@lists.proxmox.com>
Subject: Re: [PATCH v2 pve-qemu 0/2] Re-enable tcmalloc as the memory allocator
Date: Wed, 15 Apr 2026 18:22:53 +0800	[thread overview]
Message-ID: <DHTNKHTCOSVQ.1O7PCGVYVGS8F@proxmox.com> (raw)
In-Reply-To: <e2f32c37-30b8-47f3-bf93-d3e579417b09@proxmox.com>

On Tue Apr 14, 2026 at 11:36 PM CST, Fiona Ebner wrote:
> Am 14.04.26 um 1:08 PM schrieb Fiona Ebner:
>> Note that I did play around with memory hotplug and ballooning before as
>> well, not sure if related.
>> 
>> Unfortunately, I don't have the debug symbols for librbd.so.1 right now:
>> 
>>> Program terminated with signal SIGSEGV, Segmentation fault.
>>> #0  0x00007ea8da6442d0 in tc_memalign () from /lib/x86_64-linux-gnu/libtcmalloc.so.4
>>> [Current thread is 1 (Thread 0x7ea8ca66a6c0 (LWP 109157))]

Hi Fiona,

Thank you for the backtrace.

I dug into the segfault, but was not able to reprudce it locally after
performing over 3300 snapshot ops on two RBD drives, including
concurrent and batch ops.

I also searched over internet to see if we are alone. And here is what I
found: 

The crash site (SLL_Next in linked_list.h) is a known pattern in
gperftools. It's what happens when a *prior* operation corrupts a freed
block's embedded freelist pointer, and a later allocation follows the
garbage and segfaults. Essentially, tc_memalign() is the victim, not the
culprit. RHBZ #1430223 [1] and gperftools issues #1036 [2] and #1096 [3]
all describe the same crash pattern with Ceph. RHBZ #1494309 [4] is also
worth noting -- tcmalloc didn't intercept aligned_alloc() until
gperftools 2.6.1-5, causing a mixed-allocator situation where glibc
allocated but tcmalloc freed. That one's long fixed in our 2.16, but it
shows this corner of the allocator has had real bugs before.

If it happens again, probably the way to catch the actual corruption
at its source would be:

  LD_PRELOAD=libtcmalloc_debug.so.4 qemu-system-x86_64 ...

This adds guard words around allocations and checks them on free,
so it'd point straight at whatever is doing the corrupting write.
This comes with 2-5x overhead, but guess it's fine for debugging.

If you manage to reproduce it, I am more than happy to debug it with
your reproducer.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1430223
[2] https://github.com/gperftools/gperftools/issues/1036
[3] https://github.com/gperftools/gperftools/issues/1096
[4] https://bugzilla.redhat.com/show_bug.cgi?id=1494309

>
> I had added malloc_stats(); calls around
> MallocExtension_ReleaseFreeMemory(); to better see the effects, which
> also requires including malloc.h in pve-backup.c when building for
> tcmalloc. I also did a few backups before, so I can't rule out that it's
> related to that. I did a build of librbd1 and librados2 with the debug
> symbols now, but haven't been able to reproduce the issue yet. Will try
> more tomorrow.





      reply	other threads:[~2026-04-15 10:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-14  5:46 Kefu Chai
2026-04-14  5:46 ` [PATCH v2 pve-qemu 1/2] add patch to support using " Kefu Chai
2026-04-14  9:53   ` Fiona Ebner
2026-04-14  5:46 ` [PATCH v2 pve-qemu 2/2] d/rules: enable " Kefu Chai
2026-04-14 11:08 ` [PATCH v2 pve-qemu 0/2] Re-enable " Fiona Ebner
2026-04-14 15:36   ` Fiona Ebner
2026-04-15 10:22     ` Kefu Chai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DHTNKHTCOSVQ.1O7PCGVYVGS8F@proxmox.com \
    --to=k.chai@proxmox.com \
    --cc=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal