Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iqUZz-0000xq-KN for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Jan 2020 04:10:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iqUZx-0001vV-Eq for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Jan 2020 04:10:21 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iqUZw-0001vO-9V for pgsql-hackers@lists.postgresql.org; Sun, 12 Jan 2020 04:10:20 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iqUZo-0007Cg-PO for pgsql-hackers@lists.postgresql.org; Sun, 12 Jan 2020 04:10:18 +0000 Received: by mail-wr1-x435.google.com with SMTP id b6so5402356wrq.0 for ; Sat, 11 Jan 2020 20:10:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=99o90CAOY6Nd5Uof7enRV7ZKMdJWzRjfIOFkEIoNqe4=; b=RBbEBdOWYgDOqFwaLUVJcuy9vFvV5dvnrCPcxTrFdml5FhV+Xp4I6QGISVla6gplhd TLbnSB2vTGGia2NWSUVDgqoVH04lfxO3YQQss+AaAUOjrbcaOk3tGJJYdKr0qPTAY9+0 P0TgMJ3FimAeTSHTaFZOX8Zw0PI5XjzpRrxrByOyjbxmXVIaLgdJqVzhL09G8cnTwowv oGgqZxfLq0j/Uv66pZEUf1ptmN1EkEY4akd1nBR45dxRDGN6k3hhI07GYW7E3tMGYG6i qNdUc7p3MxiVRdoJQmvrdYpzajA3Yd2S0GukIBg7S4tiob/dbWoY7LuQdhpJZ362YiyH OCeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=99o90CAOY6Nd5Uof7enRV7ZKMdJWzRjfIOFkEIoNqe4=; b=EEKGt0dXQEVHYVqBqnNrER8XtW9mtbxYL7rkUd8K/yLn5V4EEI4cR8GcllnOmPNIk9 evzUSi2T8ggzqhX5m/EpegG8gLERCT96Kv+Nhqx35sFoYOdcnt3txnqZXJhmouonWZJD 0gD/Zi0bslYncC4z6oSCAXbOWcS8XQrNfo2GkN24sGiTHCBiroVwbl2Rv+MGLaRrMPLx Dw52vDa+O73tGcPVB5MbQDfTnFt64It5DwSbfG57kZ15Da6VGcMN2wIu//yrssY56j4i W9dhVxcO3DA82a5JY8znSAhyKyEWpJBPW0c2xWect3stEFWoqY0B+En57hrActgErVib owQA== X-Gm-Message-State: APjAAAWsPRBPUF6jHVSgsAUWd8Zs+If000l8HAFYa4XzXt5gCphlmJ27 0nammSVtatmmJFA3m/yN/Xkqjg== X-Google-Smtp-Source: APXvYqxikHXGJQKN1dJ00mjBIYYxt3f+NUT5Uf5Fn11fakyA6uFVJ1UmUxB6IqBdFR34UtBnmcOq+g== X-Received: by 2002:a5d:46d0:: with SMTP id g16mr11879605wrs.287.1578802210430; Sat, 11 Jan 2020 20:10:10 -0800 (PST) Received: from localhost (ip-86-49-253-92.net.upcbroadband.cz. [86.49.253.92]) by smtp.gmail.com with ESMTPSA id b15sm8652555wmj.13.2020.01.11.20.10.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Jan 2020 20:10:09 -0800 (PST) Date: Sun, 12 Jan 2020 05:10:08 +0100 From: Tomas Vondra To: Tom Lane Cc: Amit Kapila , Noah Misch , Amit Khandekar , Alvaro Herrera from 2ndQuadrant , Andres Freund , Juan =?utf-8?B?Sm9zw6kgU2FudGFtYXLDrWE=?= Flecha , PostgreSQL Hackers , Robert Haas , Thomas Munro Subject: Re: logical decoding : exceeded maxAllocatedDescs for .spill files Message-ID: <20200112041008.gddmpqunowlklc24@development> References: <20200104185148.GA2270238@rfd.leadboat.com> <20200109053704.GA2502006@rfd.leadboat.com> <22498.1578548741@sss.pgh.pa.us> <14739.1578613901@sss.pgh.pa.us> <18117.1578616812@sss.pgh.pa.us> <20200112033930.6cy3n6ybft6pp7gw@development> <29690.1578801237@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <29690.1578801237@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sat, Jan 11, 2020 at 10:53:57PM -0500, Tom Lane wrote: >Tomas Vondra writes: >> On Thu, Jan 09, 2020 at 07:40:12PM -0500, Tom Lane wrote: >>> It seems reasonably likely to me that this result is telling us about >>> an actual bug, ie, faulty back-patching of one or more of those fixes >>> into v10 and perhaps earlier branches. > >> Well, one thing we did in 11 is introduction of the Generation context. >> In 10 we're still stashing all tuple data into the main AllocSet. I >> wonder if backporting a4ccc1cef5a04cc054af83bc4582a045d5232cb3 and a >> couple of follow-up fixes would make the issue go away. > >Hm. I'm loath to back-port Generation contexts. Yeah, I agree. My suggestion was to try backpatching it and see if it resolves the issue. >But looking at >a4ccc1cef5a04cc054af83bc4582a045d5232cb3, I see that (a) the >commit message mentions space savings, but (b) the replaced code >in reorderbuffer.c doesn't look like it really would move the needle >much in that regard. The old code had a one-off slab allocator >that we got rid of, but I don't see any actual leak there ... >remind me where the win came from, exactly? > Well, the problem is that in 10 we allocate tuple data in the main memory ReorderBuffer context, and when the transaction gets decoded we pfree() it. But in AllocSet that only moves the data to the freelists, it does not release it entirely. So with the right allocation pattern (sufficiently diverse chunk sizes) this can easily result in allocation of large amount of memory that is never released. I don't know if this is what's happening in this particular test, but I wouldn't be surprised by it. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services