Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xM9Bx-00000001sgR-3KCR for pgsql-bugs@arkaria.postgresql.org; Wed, 28 Oct 2026 19:20:10 +0000 Received: from localhost ([127.0.0.1]:49918 helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xM9Bw-00000000MR9-2k2D for pgsql-bugs@arkaria.postgresql.org; Wed, 28 Oct 2026 19:20:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]:42010) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xM9Bw-00000000MQn-1fr2 for pgsql-bugs@lists.postgresql.org; Wed, 28 Oct 2026 19:20:08 +0000 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1xM9Bu-00000001StT-0rUj for pgsql-bugs@lists.postgresql.org; Wed, 28 Oct 2026 19:20:08 +0000 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-6b167ffd132so2335553a12.1 for ; Wed, 28 Oct 2026 12:20:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793215205; x=1793820005; darn=lists.postgresql.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:to:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to:content-type; bh=X2SzqCEr6GOolnjO3Frqn12ZhZN7cUGz073heo6cFK0=; b=gHx9iz38V7cbNK4uSMPIzMLPXNaOZBa+DAi9r8wn4A3A8rlco7URU/u4384bYYdguG cyzgGMEFrVJeC4axei1PBlYhCddCKV5iG9kJRt+mrdxkHurSZXl831IthYJ2CsJ2w7DV 3ScNt/fDkVWTALKcjkC3fJFO9WjzPOWjehVEoVKUD9dk6DgEZs9/kcq81lOBjref0UDi uqu39mplsdNrl/fyXS6hth4RXLMBq+PTahHP3dUnqYot0sPG8C4bb9tnE7tOg8eLT8Vc MCKgSzFyN/7dBWypCnvz2eQaJoOvPWBsjuNl/k+tl6hSMPdsOE0m1dD16rz6wkO8zprc f7Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793215205; x=1793820005; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:to:subject:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=X2SzqCEr6GOolnjO3Frqn12ZhZN7cUGz073heo6cFK0=; b=oMk6WzuNu09zzJGe3uQcZM64kJP7jLYGilY0+buOQe3JbBw1zBxi+yZEcVjTJkOVSN 1gB7hwwzeyTD/MfcfiztrUtreWuYR9Ev4vGU9bTDc+6asA11V/rqja+5lwFgwEp7O0p9 VFfuo0OjSBDQfjsQzxC+EiVfFU2ifQLFhlRUgKpFRX3xeu1LcFAgJuky2q9IJli+SH2L ZO7A3GG9Tz17230wJYJyQ1+637QRAkw0++AgeyhZ8R7c7ovP7XxCnIQ1IALYqyQVRLlt JoLUlAkJETqMNeIoZug2AK2s/vnJK0aq1sv+sCdPfKvmiTjA00hVenk71eXBbSCvr0Ji Z9Tg== X-Forwarded-Encrypted: i=1; AKwUvBzagXqrLe5s3JIUP00JI/iW+jU+kKbAwau6+5RNlsSprAsWl7r1ukHDQ3DJpQ/g+YTCoEbOd809zAXo@lists.postgresql.org X-Gm-Message-State: AFq9FYLxR+ee6tuuaLySklJOLYIWmk6wBusjuuV+oxJei7SwWvavrKuq UpLd8P2Lgl1eIkt1OGcmhbQNhyvc5rlpi6ghDcXXv5mQx/6YZZSl1dbTuRAKBeNyldQ= X-Gm-Gg: AYBFou3Z+mmG6qK+SYJM3X9DPY19pydIiX26KhhzsauA8teZ13hMzIA7ACQAQRn3AtW 6VdmEpv51wb2Y7xPvlTujdrUjtpMNMb604cMVus0Z8V9h7JmfwMZAZjXUNaeuZjQrcpxZYVFtoj 2Uzg8csbh1mVeEhDHcQhAd6xUdUMovepidI807UkPmTPXmzzUc/fb1HVkxPxSXU9tQWQRxd4tG3 7UeCknSU+GuO0huqvb9N3vlLAFXe+jURSbIpQ/YAVEdBOPmjzWpEBjx1587ByX71eCNOG4WcoG+ LR3FurpVmRaHsOeDKgIi8ot1tyeZUT3VGMPU5ne8QsE1+M2FaLSx6lrbadBqY2B9ICwra4B07HL o8zX+GsjzrA5HbcLVXLqrenJvHfS88/t4bGmU+qer2OjuSAF5Q2gRK/8Pjtkq1QdGipCBvXyHEW 192rqshW1nf0diBnquWdRu8u69JyWhbCpMhah+5kT5C21UdRkbT5X85x9LZdfHcT56yS4ItyZVQ mdDKobOTsOCzt5VYY/FLbHhZi22w1jFb65R2K45SCatOavJk3f/xZcsOxK+5C3WFDKkZESyvbjK h7HQPKECQ5vkkTs+s2Uh0uLqVFpumwjTVZyAHzGuuEjTglK4EB4SN/b/XQfkhz7iC+GKzEs3ro/ mN4UcrWsOnX7zrXge X-Received: by 2002:a17:907:6e8d:b0:c46:5c4c:7f66 with SMTP id a640c23a62f3a-c49bdedd0c7mr272755466b.14.1793215204883; Wed, 28 Oct 2026 12:20:04 -0700 (PDT) Received: from [10.255.187.105] (vip-148-139-2-229.cust.service-now.com. [148.139.2.229]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c46bd34fbcfsm650113066b.2.2026.10.28.12.20.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Oct 2026 12:20:01 -0700 (PDT) Message-ID: <23946400-3809-499d-b0bc-5f859df8ef50@gmail.com> Date: Wed, 28 Oct 2026 20:19:59 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: crash in ltree_compare_distance() in 14.24 To: Chris St Denis , pgsql-bugs@lists.postgresql.org References: <043a5139-1f0c-49df-b423-1cd129839aa9@ctgameinfo.com> <497fe0b6-2f8c-4237-b749-bed21de36c01@gmail.com> <3527d5c4-0ce4-4412-b433-2e1d36517139@ctgameinfo.com> Content-Language: en-US From: David Geier In-Reply-To: <3527d5c4-0ce4-4412-b433-2e1d36517139@ctgameinfo.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk >> In case you cannot reproduce it, can you share at least the query you >> were running and the relevant parts of the schema? > > It happened in the middle of the night, has not happened since. > > The ltree column id_tree contains a ltree of comment ID's showing the > tree of comment replies. > > Logs show this > >      2026-10-26 02:26:35.914 PDT [61206] LOG:  server process (PID >    50023) was terminated by signal 11: Segmentation fault >      2026-10-26 02:26:35.914 PDT [61206] DETAIL:  Failed process was >    running: INSERT INTO "story_comments" ("comment", "reply_to", >    "deleted", "id_tree", "sid", "user_id", "ipaddr") VALUES ($1, $2, >    $3, $4, $5, $6, $7) > > Due to parameterised queries, I do not have the data values that were > inserted. > > Here is the table structure. Thanks for sharing the details. What can be concluded from the core dump information you shared in your first mail is that the read of b->numlevel in float ltree_compare_distance(const ltree *a, const ltree *b) { ltree_level *al = LTREE_FIRST(a); ltree_level *bl = LTREE_FIRST(b); int an = a->numlevel; int bn = b->numlevel; causes the segfault, likely because "b" is a corrupted pointer. The value of b is 0x127a2f2a13, which is unaligned and far away from "a" which is 0x2fa39243b1d8 and aligned as expected. Beyond that, the "a" ltree is empty / has 0 levels as can be inferred from edx = 0. I tried to create a failing test case based on your schema details but failed. I'm assuming that the order of INSERTs and the data matters. What you could try is open your core dump and go down the call stack to see where "b" gets messed up. It would also be interesting which of the two calls to ltree_compare_distance() in ltree_penalty() causes the segfault. Do you use data checksums? If not, maybe the issue stems from a data corruption on disk? FYI: PostgreSQL 14 reaches end of life on November 12, 2026. Though, I think it's not unlikely that this bug is also on master. -- David Geier