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.96) (envelope-from ) id 1w6ze3-004r25-2L for pgsql-bugs@arkaria.postgresql.org; Sun, 29 Mar 2026 23:34:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w6ze0-00HagJ-2q for pgsql-bugs@arkaria.postgresql.org; Sun, 29 Mar 2026 23:34:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w6ze0-00HagB-23 for pgsql-bugs@lists.postgresql.org; Sun, 29 Mar 2026 23:34:13 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w6zdy-00000001tnx-0oCv for pgsql-bugs@lists.postgresql.org; Sun, 29 Mar 2026 23:34:12 +0000 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-43b9d3ebed5so2554075f8f.1 for ; Sun, 29 Mar 2026 16:34:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774827249; cv=none; d=google.com; s=arc-20240605; b=JR8F2pDUtjVol6kBdcHc1NayeSuMF7RpE+BJOOj60zGIPNPHjkGxHXNRqsIP27zwVg 0/fm+6+/vKiQ6eU1z/xT8VFSX8ALNwT1PvGJBKnq4tHxEPX20R2+ekHzBH5sDme0Z6zS Sl87WOi9u1LEHLFHSoW/iUwGp/3S2Mx1YsRDjCw8zhGAsl8avinI5Bj1uvO+2dqi9BdZ 6ZGvpvowUfDVyWBdaJdvVM00I0t1jF651uHCP6Yz6XKeko5R5GTvZZAaIiBbxfjk8e0N YyQer8lPfnjgp9sDYMh8fWaCJCZuhqffm1l8odTeJ9RLfpyTis5HtPAeXpyD31EU+xhB YTcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=sPg3sBKSTIhYYl0G8mm9SiKsbbaktAq+zwmyr/gp7BE=; fh=WWWDlSWCSYlz/lWmNM6UBXGDXBxFtjvrmrlJHstKhNo=; b=QcHeVtd8mOeFjKlHblqgqolKOKIPvjmOT+d2ic+L+nitHi/nlMag+3JWVkcFU6QKyn rUg+vp8mtwRTnz0AwYZlV2mVoypgPbiMjOPSwo6AtlDxIVMM3WbmykT4IFQ4wA1YQrUH 38YxwKxXvYy4kbdp7EoUI2KaLEb+RrJPwd11+/y2uIcKLhnMKOL8cyhmdQNjTKh75cvS 9/IC7w6TSnFG7E7NsDf130Em9gWI02mDSOVwsybsjxVq73xgEU33nmhyjZ3T8izf1jO0 YfQRo2X2xTkjRvcxr3S2hSqDIDAaseac/KOGOc/w2XScN5qKoMBiU+cQ1moA4JfBKmQF L/kw==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774827249; x=1775432049; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=sPg3sBKSTIhYYl0G8mm9SiKsbbaktAq+zwmyr/gp7BE=; b=fG2JD9EJeIues+pBg9PtKMtk0JN2SvhNVgjD6QwquQEgesJMBTPdJM+IH4rWb4xjY1 7EKOViZzxgomxsusyKqaL/v0g8EKqETH/nlpZGMb13YJMOxyy4VnoWfCaaednibREG48 imtU/pm5l8qveCMPPSaBo55Mp5e407hAuBH/yBqmpAPkbtP85bIRNS3wbGOVPGHXHEFS S5zLlBZeB6HI7SsUkqfFmC+TeSJMi0sphyHtz66ObEvgYW/qZN9+jt5qig6teCpt2vXU UvrRV6l4la25LpS99bBvtjG48O1FXhDo/rOZzZ9t2hJUAoyAF26cdPq23A9BpTH5f22a h7Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774827249; x=1775432049; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=sPg3sBKSTIhYYl0G8mm9SiKsbbaktAq+zwmyr/gp7BE=; b=cWjJciT/JZP/dYyr2qF/0vr98ZVJkBrQSInJEOSilrtJkmxSGphl3gi4vkR/zzyOcA 3oaJWx/elk9QLvKeThEsbYNFzMylGo9HT94kkGM2lhmVt9uu7Pgnc6vFZjZ+ERgOX6zo 0UsX2eedziFz3nkB7hP4DYpKl9oQfvgSmdG3hN1s85sOdMWzimDjneWLFnLouDGw7gbX 63vqUKNIYzYVM5lvrhCkvvmf3iazuFIL6UotNX2AOvtHB6jsxQ72btWP8+Kp/snrJR/P tqTVUWaR5MsKZeaTTDflp1Efm0R/d7ouky5fAU3K6gxW2rKxu+Q4YJF7qaCLiew96k7V IkiQ== X-Forwarded-Encrypted: i=1; AJvYcCV1ADuO7xbIiygCV9wiYYlAO/7yY2jZZCYZAqNVuWlOk2O/Fz5uKF3Uy88H0SnDROnR+XJ2r89D8tTU@lists.postgresql.org X-Gm-Message-State: AOJu0YyMPX4CsNd+yCLJUzTbaec1EC3S6rOuz9NWzi9SMO+egpHlvUtC PIHt5LqL+HWrZd81Dv5TqOXC2WxEBDJ3wD3r7GqODYuztX4TX5vCvLdILA+VhMJiIMLzCZ5E8TR 7phJDbsr5xA+rWbCIZG/WxCongX/KrkI= X-Gm-Gg: ATEYQzwzogc3+7+co8CkAm8Ia2ayBAo/JL1x4TID4hVYG8Tus22oaLPMZt80wI2w4ox vzAZL9x9rq/Cb3hpvxEJ8fvudkB2R04t3/G+wkB4z9VSxLLIRswPYnnRimx76B462RBicI6lJtr l7JB1uFreAEuRXmk/kKxgn5vagrvG1vVRA/htV6voFB3M5knxuFLK6b+83273pWhLDhWVDSb1QW WHY9jDOYp+CU0aT6SvqSHsNGnD8t1Nnwv2b0XzVRlKPtzgKj7T6BMDbzZLPwAIm9//SUoogiDqx waFOftotZ7mFGwhcVUz0uKxuB+mXMZdqvsYPRdW9ybL+5PmzX0BBbjDY1qlbcK3xc+xHeGFTK4H DVObReI26 X-Received: by 2002:adf:e40b:0:b0:43c:f275:7c6c with SMTP id ffacd0b85a97d-43cf2757d5dmr8302045f8f.51.1774827249004; Sun, 29 Mar 2026 16:34:09 -0700 (PDT) MIME-Version: 1.0 References: <19438-9d37b179c56d43aa@postgresql.org> <1106026.1774573371@sss.pgh.pa.us> <1338824.1774633289@sss.pgh.pa.us> <1830345.1774798374@sss.pgh.pa.us> <1835962.1774801538@sss.pgh.pa.us> In-Reply-To: <1835962.1774801538@sss.pgh.pa.us> From: David Rowley Date: Mon, 30 Mar 2026 12:33:57 +1300 X-Gm-Features: AQROBzDIbwij3DJjtlizGfVD5fBH_asWL1Jm7nNatKPPRf4WZtIdAdLYrPblLZ4 Message-ID: Subject: Re: BUG #19438: segfault with temp_file_limit inside cursor To: Tom Lane Cc: kuzmin.db4@gmail.com, pgsql-bugs@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 30 Mar 2026 at 05:25, Tom Lane wrote: > I started to wonder if an explicit test in AlignedAllocFree > could be useful anyway to make such problems a bit less obscure. > However, when I tried > > p = palloc_aligned(...); > pfree(p); > pfree(p); > > I got > > ERROR: pfree called with invalid pointer 0x1f286b0 (header 0x7f7f7f7f7f7f7f7f) > > That is, we'll never get to AlignedAllocFree because the underlying > context would have wipe_mem'd the aligned chunk's header during the > first pfree. The only case in which such a test could be helpful is > in a build with MEMORY_CONTEXT_CHECKING but not CLOBBER_FREED_MEMORY. > While I suppose some people might build that way, it's got to be such > a tiny minority as to not be worth worrying about. I think you might have trouble trying to get the MemoryContext.name for the elog warning anyway. That's only accessible from the unaligned allocation and whatever method that context type uses to backlink the owning context from the chunk pointer. Given that, it very much seems not worthwhile as I imagine that means adding some callback function to MemoryContextMethods! David