Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Jan 2024 09:34:43 -0800
From:      Enji Cooper <yaneurabeya@gmail.com>
To:        Farhan Khan <farhan@farhan.codes>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: jemalloc_rtree failed assertion error
Message-ID:  <80D5F142-9A53-4885-9CE3-0E634890B217@gmail.com>
In-Reply-To: <5fe4d15c-f976-4a41-ac50-38ce6a25c289@app.fastmail.com>
References:  <5fe4d15c-f976-4a41-ac50-38ce6a25c289@app.fastmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]

> On Jan 6, 2024, at 14:48, Farhan Khan <farhan@farhan.codes> wrote:
> 
> Hi all,
> 
> I am writing some code on FreeBSD 15.0-CURRENT and getting this error that I do not understand:
> 
> <jemalloc>: jemalloc_rtree.c:205: Failed assertion: "!dependent || leaf != NULL"
> 
> In this case, it happens during a realloc() call. This may very well be a bug in my code, but the message is unclear to me. I found the section the section in the code (/usr/src/contrib/jemalloc/src/rtree.c) but without thoroughly diving into the malloc() call I do not understand it. The jemalloc(3) man page has a section called "DIAGNOSTIC MESSAGES", but it does not offer many details.
> 
> What does this error mean?
> 
> As an aside, I recommend that this is either documented in more detail because I found several people citing the problem but I did not find an explanation.

Hi Farhan!

I would reach out to the author, Justin Evans about potential improvements in terms of the diagnostic message via the jemalloc project GitHub issue tracker.

Also, taking a stab based on closed issues, it might be that the memory being reallocated is not being managed via jemalloc: https://github.com/jemalloc/jemalloc/issues/2500 . If the memory is being managed via some custom malloc code not in libc/jemalloc (a prime example being python’s default memory arena allocator) or is stack memory, the memory will need to be copied to an address managed via jemalloc using callow/memcpy/etc.

Best of luck!
-Enji
[-- Attachment #2 --]
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div dir="ltr"></div><div dir="ltr"><br></div><div dir="ltr"><blockquote type="cite">On Jan 6, 2024, at 14:48, Farhan Khan &lt;farhan@farhan.codes&gt; wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><span>Hi all,</span><br><span></span><br><span>I am writing some code on FreeBSD 15.0-CURRENT and getting this error that I do not understand:</span><br><span></span><br><span>&lt;jemalloc&gt;: jemalloc_rtree.c:205: Failed assertion: "!dependent || leaf != NULL"</span><br><span></span><br><span>In this case, it happens during a realloc() call. This may very well be a bug in my code, but the message is unclear to me. I found the section the section in the code (/usr/src/contrib/jemalloc/src/rtree.c) but without thoroughly diving into the malloc() call I do not understand it. The jemalloc(3) man page has a section called "DIAGNOSTIC MESSAGES", but it does not offer many details.</span><br><span></span><br><span>What does this error mean?</span><br><span></span><br><span>As an aside, I recommend that this is either documented in more detail because I found several people citing the problem but I did not find an explanation.</span><br></div></blockquote><div><br></div><div>Hi Farhan!</div><div><br></div>I would reach out to the author, Justin Evans about potential improvements in terms of the diagnostic message via the jemalloc project GitHub issue tracker.<div><br></div><div>Also, taking a stab based on closed issues, it might be that the memory being reallocated is not being managed via jemalloc:&nbsp;<a href="https://github.com/jemalloc/jemalloc/issues/2500">https://github.com/jemalloc/jemalloc/issues/2500</a>&nbsp;. If the memory is being managed via some custom malloc code not in libc/jemalloc (a prime example being python’s default memory arena allocator) or is stack memory, the memory will need to be copied to an address managed via jemalloc using callow/memcpy/etc.</div><div><br></div><div>Best of luck!</div><div>-Enji</div></body></html>

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?80D5F142-9A53-4885-9CE3-0E634890B217>