Date: Mon, 8 Jan 2024 09:36:37 -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: <DA66A897-ADDB-4F8C-9D2D-58D9E42DF899@gmail.com> In-Reply-To: <80D5F142-9A53-4885-9CE3-0E634890B217@gmail.com> References: <80D5F142-9A53-4885-9CE3-0E634890B217@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail-57A9BF7D-9747-48E5-BE86-DC3788ED746A Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > On Jan 8, 2024, at 09:34, Enji Cooper <yaneurabeya@gmail.com> wrote: >=20 > =EF=BB=BF >=20 >>> On Jan 6, 2024, at 14:48, Farhan Khan <farhan@farhan.codes> wrote: >>>=20 >> =EF=BB=BFHi all, >>=20 >> I am writing some code on FreeBSD 15.0-CURRENT and getting this error tha= t I do not understand: >>=20 >> <jemalloc>: jemalloc_rtree.c:205: Failed assertion: "!dependent || leaf != =3D NULL" >>=20 >> 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 s= ection in the code (/usr/src/contrib/jemalloc/src/rtree.c) but without thoro= ughly diving into the malloc() call I do not understand it. The jemalloc(3) m= an page has a section called "DIAGNOSTIC MESSAGES", but it does not offer ma= ny details. >>=20 >> What does this error mean? >>=20 >> As an aside, I recommend that this is either documented in more detail be= cause I found several people citing the problem but I did not find an explan= ation. >=20 > Hi Farhan! >=20 > I would reach out to the author, Justin Evans about potential improvements= in terms of the diagnostic message via the jemalloc project GitHub issue tr= acker. >=20 > Also, taking a stab based on closed issues, it might be that the memory be= ing reallocated is not being managed via jemalloc: https://github.com/jemall= oc/jemalloc/issues/2500 . If the memory is being managed via some custom mal= loc code not in libc/jemalloc (a prime example being python=E2=80=99s defaul= t memory arena allocator) or is stack memory, the memory will need to be cop= ied to an address managed via jemalloc using callow/memcpy/etc. This should read =E2=80=9Ccalloc=E2=80=9D (pesky autocorrect got it wrong). >=20 > Best of luck! > -Enji --Apple-Mail-57A9BF7D-9747-48E5-BE86-DC3788ED746A Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=3D= utf-8"></head><body dir=3D"auto"><div dir=3D"ltr"></div><div dir=3D"ltr"><br= ></div><div dir=3D"ltr"><blockquote type=3D"cite">On Jan 8, 2024, at 09:34, E= nji Cooper <yaneurabeya@gmail.com> wrote:<br><br></blockquote></div><b= lockquote type=3D"cite"><div dir=3D"ltr">=EF=BB=BF<meta http-equiv=3D"conten= t-type" content=3D"text/html; charset=3Dutf-8"><div dir=3D"ltr"></div><div d= ir=3D"ltr"><br></div><div dir=3D"ltr"><blockquote type=3D"cite">On Jan 6, 20= 24, at 14:48, Farhan Khan <farhan@farhan.codes> wrote:<br><br></blockq= uote></div><blockquote type=3D"cite"><div dir=3D"ltr">=EF=BB=BF<span>Hi all,= </span><br><span></span><br><span>I am writing some code on FreeBSD 15.0-CUR= RENT and getting this error that I do not understand:</span><br><span></span= ><br><span><jemalloc>: jemalloc_rtree.c:205: Failed assertion: "!depen= dent || leaf !=3D NULL"</span><br><span></span><br><span>In this case, it ha= ppens during a realloc() call. This may very well be a bug in my code, but t= he message is unclear to me. I found the section the section in the code (/u= sr/src/contrib/jemalloc/src/rtree.c) but without thoroughly diving into the m= alloc() call I do not understand it. The jemalloc(3) man page has a section c= alled "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 exp= lanation.</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 i= mprovements in terms of the diagnostic message via the jemalloc project GitH= ub issue tracker.<div><br></div><div>Also, taking a stab based on closed iss= ues, it might be that the memory being reallocated is not being managed via j= emalloc: <a href=3D"https://github.com/jemalloc/jemalloc/issues/2500">h= ttps://github.com/jemalloc/jemalloc/issues/2500</a> . If the memory is b= eing managed via some custom malloc code not in libc/jemalloc (a prime examp= le being python=E2=80=99s 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></blockquote><div><br></div>This should read =E2= =80=9Ccalloc=E2=80=9D (pesky autocorrect got it wrong).<div><br><blockquote t= ype=3D"cite"><div dir=3D"ltr"><div><br></div><div>Best of luck!</div><div>-E= nji</div></div></blockquote></div></body></html>= --Apple-Mail-57A9BF7D-9747-48E5-BE86-DC3788ED746A--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DA66A897-ADDB-4F8C-9D2D-58D9E42DF899>