From nobody Mon Jan 8 17:34:43 2024 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T81R65RNLz56C1R for ; Mon, 8 Jan 2024 17:34:58 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T81R53LMfz4rhk for ; Mon, 8 Jan 2024 17:34:57 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20230601 header.b=EksSwnOp; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of yaneurabeya@gmail.com designates 2607:f8b0:4864:20::62b as permitted sender) smtp.mailfrom=yaneurabeya@gmail.com Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1d542701796so5138985ad.1 for ; Mon, 08 Jan 2024 09:34:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704735295; x=1705340095; darn=freebsd.org; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=V5d9JlZgrnBCXkwEM6L0dgm7Jnfq6OPksbnPB58xB/E=; b=EksSwnOp9xp3kjq9edToaIeerKjhYK7zP+hbaXJ1vI98FsBw+DFIw1sxZlVns/Ydw+ sUrkCdQ/fAzx/WWHYdAh+wLeQf3ef5n39Alk/3jIqd58dlRLJ8Xw1BlBysBWOKnFBHev 3Xg926W26b5yq8K+pxX/rBKoidgdiyW/8maON4hMbcitR1GBgZEppK8+2q5UH30VKuGx RKA24NnxWtiiW0Ez87Beub6UUgPzYGCGAXhlvynvMimtTUTeyl+XWAJDjSE9C8FdiofX s3NvVzFC4FHHmvIl8OCBbwZZPHqFN83mhd8xKYjQzLM69pPmtmJc9mgm468IlK7+mgO2 d/jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704735295; x=1705340095; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V5d9JlZgrnBCXkwEM6L0dgm7Jnfq6OPksbnPB58xB/E=; b=RQm8gqnBVXcrD8N9eY63l+YdG6YN8ueaa0MdwYrzt5ZmoOHGS8iPxf1/tCVBzZpk64 PZ2CRK5PcI/9Hu4uo0oJRBhatEROWQotiKhvuB62OFP4webAF20S9C5DIJqEPMQIDu1w L2Yd6+vEXepIYipb/+a00Y95URVeJUHJkcPHhXnm+C0f1vWEbCSyK3G6MrTEzNz8Fx6s fNw2IQq4gUb1zjltndcn93+dd3WXlO4YILtBnnLbJ6T6RFEN/n+vkAeuti/TQ9anMOMc hT1expPf0jtVoMcsY0vQrB9mHcfmWIs+/1bggRM6qMeWjod+3XoQels0bhRObaLW7FWu ZIKQ== X-Gm-Message-State: AOJu0YxWaYANHAsg8eg/X+6ANr03dTP8mXqkqNjOvZi/CHIbNp2wP1hN 7ZCCgKN1Py4rWfrmEJMhOnyBtIxundisuw== X-Google-Smtp-Source: AGHT+IFR6GAW9wII1eUtUVPahDcL78x+JWSfQNx6Po9VNpaWbgrADdp/+v+aQl6soLWhBzs+E2DxUw== X-Received: by 2002:a17:903:22d2:b0:1d4:cf2b:6bfe with SMTP id y18-20020a17090322d200b001d4cf2b6bfemr1955502plg.0.1704735295346; Mon, 08 Jan 2024 09:34:55 -0800 (PST) Received: from smtpclient.apple ([2601:601:782:be00:6d3a:9589:2cd:25df]) by smtp.gmail.com with ESMTPSA id u1-20020a170902e80100b001d3d8e30ca5sm167324plg.91.2024.01.08.09.34.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Jan 2024 09:34:54 -0800 (PST) Content-Type: multipart/alternative; boundary=Apple-Mail-03E380CB-2F6D-4BD1-8342-821A937DE9D2 Content-Transfer-Encoding: 7bit From: Enji Cooper List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org Mime-Version: 1.0 (1.0) Subject: Re: jemalloc_rtree failed assertion error Date: Mon, 8 Jan 2024 09:34:43 -0800 Message-Id: <80D5F142-9A53-4885-9CE3-0E634890B217@gmail.com> References: <5fe4d15c-f976-4a41-ac50-38ce6a25c289@app.fastmail.com> Cc: freebsd-hackers@freebsd.org In-Reply-To: <5fe4d15c-f976-4a41-ac50-38ce6a25c289@app.fastmail.com> To: Farhan Khan X-Mailer: iPhone Mail (21B101) X-Spamd-Bar: --- X-Spamd-Result: default: False [-4.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20230601]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; RCVD_TLS_LAST(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; RCPT_COUNT_TWO(0.00)[2]; FREEMAIL_FROM(0.00)[gmail.com]; TO_DN_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; APPLE_IOS_MAILER_COMMON(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; MID_RHS_MATCH_FROM(0.00)[]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::62b:from] X-Rspamd-Queue-Id: 4T81R53LMfz4rhk --Apple-Mail-03E380CB-2F6D-4BD1-8342-821A937DE9D2 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > On Jan 6, 2024, at 14:48, Farhan Khan wrote: >=20 > =EF=BB=BFHi all, >=20 > I am writing some code on FreeBSD 15.0-CURRENT and getting this error that= I do not understand: >=20 > : 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 b= ug in my code, but the message is unclear to me. I found the section the sec= tion in the code (/usr/src/contrib/jemalloc/src/rtree.c) but without thoroug= hly diving into the malloc() call I do not understand it. The jemalloc(3) ma= n page has a section called "DIAGNOSTIC MESSAGES", but it does not offer man= y details. >=20 > What does this error mean? >=20 > As an aside, I recommend that this is either documented in more detail bec= ause I found several people citing the problem but I did not find an explana= tion. Hi Farhan! I would reach out to the author, Justin Evans about potential improvements i= n terms of the diagnostic message via the jemalloc project GitHub issue trac= ker. Also, taking a stab based on closed issues, it might be that the memory bein= g reallocated is not being managed via jemalloc: https://github.com/jemalloc= /jemalloc/issues/2500 . If the memory is being managed via some custom mallo= c code not in libc/jemalloc (a prime example being python=E2=80=99s default m= emory 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= --Apple-Mail-03E380CB-2F6D-4BD1-8342-821A937DE9D2 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On Jan 6, 2024, at 14:48, = Farhan Khan <farhan@farhan.codes> wrote:

=EF=BB=BFHi all,

I am writing some code on FreeBSD 15.0-CURRENT and getti= ng this error that I do not understand:

<= ;jemalloc>: jemalloc_rtree.c:205: Failed assertion: "!dependent || leaf != =3D NULL"

In this case, it happens during a= realloc() call. This may very well be a bug in my code, but the message is u= nclear 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 "DIAGNO= STIC MESSAGES", but it does not offer many details.
<= br>What does this error mean?

As an a= side, I recommend that this is either documented in more detail because I fo= und 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 i= n terms of the diagnostic message via the jemalloc project GitHub issue trac= ker.

Also, taking a stab based on closed issues, it might= be that the memory being reallocated is not being managed via jemalloc:&nbs= p;https://githu= b.com/jemalloc/jemalloc/issues/2500 . If the memory is being manage= d via some custom malloc code not in libc/jemalloc (a prime example being py= thon=E2=80=99s default memory arena allocator) or is stack memory, the memor= y will need to be copied to an address managed via jemalloc using callow/mem= cpy/etc.

Best of luck!
-Enji
= = --Apple-Mail-03E380CB-2F6D-4BD1-8342-821A937DE9D2--