Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1egwFc-00065Y-I9 for pgsql-general@arkaria.postgresql.org; Wed, 31 Jan 2018 17:32:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1egwFa-00066d-TW for pgsql-general@arkaria.postgresql.org; Wed, 31 Jan 2018 17:32:46 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1egwFa-00066U-G0 for pgsql-general@lists.postgresql.org; Wed, 31 Jan 2018 17:32:46 +0000 Received: from mail-wr0-x233.google.com ([2a00:1450:400c:c0c::233]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1egwFT-000881-M2 for pgsql-general@lists.postgresql.org; Wed, 31 Jan 2018 17:32:45 +0000 Received: by mail-wr0-x233.google.com with SMTP id v15so15898829wrb.8 for ; Wed, 31 Jan 2018 09:32:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=framestore.com; s=google; h=subject:references:cc:from:to:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=9riusOKfH8wn4SVI1pDqwnIz+bQqSnad9scDwRsFROE=; b=MTUMaKHlLWC2BZKrelYFqTAD0AOBSo3QoOI/4xw6AECItNbo7gcxzozmn+8FfUpNVF 8KRsS12oNDpzYlEUZ5ibeHuWOzDk+BDWYo/4JSRHtnNffuf0fmNd+Mgr28jGSKNah405 PzPL4G4Qw+QzmIWSGbdevjVL9ay95n1+Idnog= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:references:cc:from:to:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=9riusOKfH8wn4SVI1pDqwnIz+bQqSnad9scDwRsFROE=; b=Y6csl9rlDX7XIHLWEPw5AmgPZxZ3eovEHWxXBetHoZeekF6wvdDrZl2PIu2KAw+l3T FwvqFZjWj0GXzNxOSKH2ZRQZYwXqWYVi19Z+UZ9ZS0Pnompz/x+QV5A4TIIpEfu2DDfL V2utosQ7NstNpwa6azRbFBea50yHmfGm5pbA4U4rvfGe5DrbDBrEZJsjfjpW3DgcH6HX ekfaimrZyjJH9sPrY7zz/HdDBBn6xDrNl/rSn6//jqKj6MSHq+WJIblZIhNddIVj+zms fyBqa6yKoeOWXiXcvaqx1z/vQW0ir1eysXvCuzezNRjzl0IiqSUAW78uyL5SiNZDg7Hp DZNA== X-Gm-Message-State: AKwxyteuMw+6r55ugMa36GSa7zW9KPvtEkxN7LOI98c0wjHIh9yYkRYU CzsFpUMQyl8T6RN2WiYGllgcHgPL X-Google-Smtp-Source: AH8x227btjLNOgYI5E4gcKuUDJ+NTCas7v+kTzSRLbRQL54qUnist04b7dpg0f43RVoVKDFzMyH4RQ== X-Received: by 10.223.166.7 with SMTP id k7mr19202328wrc.242.1517419956232; Wed, 31 Jan 2018 09:32:36 -0800 (PST) Received: from sys1099.ldn.framestore.com (ldndefault.framestore.com. [185.101.14.7]) by smtp.gmail.com with ESMTPSA id m7sm11346865wrb.91.2018.01.31.09.32.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Jan 2018 09:32:35 -0800 (PST) Subject: Re: ERROR: invalid memory alloc request size 1073741824 References: <733ecd96-48ed-8d49-15e1-413eb535c4c6@framestore.com> <28d517a9-bf36-1a79-c2e7-6356dcd31064@2ndquadrant.com> Cc: pgsql-general@lists.postgresql.org From: Stefan Blanke To: Tomas Vondra , Jan Wieck Message-ID: Date: Wed, 31 Jan 2018 17:32:35 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <28d517a9-bf36-1a79-c2e7-6356dcd31064@2ndquadrant.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > That very much depends on where exactly the failure happens - it might > be both (or relying on an assumption that changed over). It's not clear > if it fails during query execution or formatting the output (I seem to > remember there were/are issues with rows containing multiple large bytea > values, for example). > > Can you attach gdb to the backend, set breakpoint on that elog and share > the backtrace? Then we can investigate further. I can't easily get a meaningful query plan (i.e. from the live system) as the query that failed is based on a temporary table built by some pl/pgsql (the database is more of a conveyor belt than a long term store). Unfortunately it's difficult to reproduce the ERROR. This has only occurred a couple of times on a live system in the last year and these queries run frequently. I think we will move to 9.5.10 and see if it ever happens again; then if it does get a backtrace on that newer version. Incidentally we never saw this error on 8.4 where this code was running from 2009 until 2017. > I'll bet you it's not that. It's quite unlikely that would fail with > exactly 1GB request size. It seems much more like a buffer that we keep > to be power of 2. The question is which one. I had dismissed corruption before writing in. It's exactly 1GB every time this has happened - and we can dump the full dataset periodically without issue. >> I have my money on a corrupted TOAST entry. Is this happening on >> trustworthy hardware or beige box with no ECC or RAID? It's good quality commercial hardware in our colo - no exactly sure what. Thanks for taking the time to look at this! Stefan On 01/30/18 22:00, Tomas Vondra wrote: > > > On 01/30/2018 10:43 PM, Jan Wieck wrote: >> >> >> On Tue, Jan 30, 2018 at 12:35 PM, Stefan Blanke >> > wrote: >> >> Hello, >> >> We've tripped over an error when doing a "COPY.. TO STDOUT WITH >> BINARY" query. >> >> "ERROR: invalid memory alloc request size 1073741824" >> (exactly 1GB) >> >> >> I have my money on a corrupted TOAST entry. Is this happening on >> trustworthy hardware or beige box with no ECC or RAID? >> > > I'll bet you it's not that. It's quite unlikely that would fail with > exactly 1GB request size. It seems much more like a buffer that we keep > to be power of 2. The question is which one. > > > regards >