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 1egcxc-0001xK-TG for pgsql-general@arkaria.postgresql.org; Tue, 30 Jan 2018 20:56:57 +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 1egcxb-00007L-AV for pgsql-general@arkaria.postgresql.org; Tue, 30 Jan 2018 20:56:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1egcxa-00007C-Vg for pgsql-general@lists.postgresql.org; Tue, 30 Jan 2018 20:56:55 +0000 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1egcxW-0002fD-W9 for pgsql-general@lists.postgresql.org; Tue, 30 Jan 2018 20:56:54 +0000 Received: by mail-wr0-x243.google.com with SMTP id t94so1167319wrc.5 for ; Tue, 30 Jan 2018 12:56:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=EYQDyNHtH8rIkB9X2nPvl5q6WTZvj1Tb6k4V1BbckpU=; b=kVfNXBFWI0IsysuGF4z+o1FRgkVEG57idd6iX/HoQ/ibMEWGvqafh5YjQmWGiH605h lzWZJgLH0liscxXsftvmoBaW9C9D/qZzuako69obftYS3lney06vjNUVT69a9Zssfhuy xP0PxXnuaLVNJg9gY2bPj5cqPGB97Srg/87IiXU00RdTK3NqIxYe4xGIdasTBTwcZFj/ P7StkllGVHvLVY9SzMiVoFjWQW9DxMJcLF9ua3j4gZGkI0ohsOWh0Wb4zefj3tKcceoV L9HnZKmV0Zgeeibx7qyamNioabOe13t0bRRoWkp7Qt5OOofvMRmkeAVm9jUxFEHvqhL7 HXJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=EYQDyNHtH8rIkB9X2nPvl5q6WTZvj1Tb6k4V1BbckpU=; b=m0opeaRT4uZyyRm3p+qH1pe0s6TfaBjxce6GJoadSU/RDb7w1LdGeCmiLo3tZtmp7S N43smgkwR7zD35sf5zjQkpsl+P+WTrx9U/oqB8SzZzMgY4UjPXIfYTSMNiXFBgYLR8kW IxxZ2OXH7pdXuR3FJr7be+8njkbLVBYQCAGedX0SiuGkcp92jXWL8mKWhS45fK+3GbI8 QaB1VBB5zwbwCZvcWZkopmnYoEhRu4xMKXV7P8DICz2cOvRSMhOsJOW2Kv/4qnLYAW3k Kf1NbKFww5O8zS39Oco4HNcuui3rWVNFcYNTknPuVjR8Wx0LbtlUdU9/WbvzldpyLSBi 7r3w== X-Gm-Message-State: AKwxytdEUlN1/60UkmBYeCU366peJbydrIVmWRrDzTCVkKrIXm/NoV5s 9xxW5IFb7P9RcbDlI8PnIILKvDIs4YlugHk/ysgm3X8nCb0W6GLNJHymbcHXY+EzMIzIV4x7DbF Dln+tqm4f31kGsslt6/e1lXn+RZCx2PU0NNcGKzswROjFAofdqQvu0Oc4U/mpY/QJ5sjA6Fr30h ltmVLRxjiQCpmjpLXH X-Google-Smtp-Source: AH8x2277zBJsHA1o+zqzUTPpO4Zx/e4RVs3vxQaS1fc5fnZQBueGH+O5dJmXLitpfEouyQuQsBLk5A== X-Received: by 10.223.190.141 with SMTP id i13mr6462595wrh.211.1517345809515; Tue, 30 Jan 2018 12:56:49 -0800 (PST) Received: from [10.137.2.19] (ip-78-102-97-226.net.upcbroadband.cz. [78.102.97.226]) by smtp.gmail.com with ESMTPSA id q186sm16073930wmb.33.2018.01.30.12.56.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 12:56:48 -0800 (PST) Subject: Re: ERROR: invalid memory alloc request size 1073741824 To: Stefan Blanke , pgsql-general@lists.postgresql.org References: <733ecd96-48ed-8d49-15e1-413eb535c4c6@framestore.com> From: Tomas Vondra Message-ID: Date: Tue, 30 Jan 2018 21:56:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <733ecd96-48ed-8d49-15e1-413eb535c4c6@framestore.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 01/30/2018 06: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) > > So a palloc() call is failing on the AllocSizeIsValid() check. > > Does anyone know if this a safety catch we are tripping with a bad > query - or whether this check is something that should never be hit > (i.e. a bug). > 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. In case you don't have experience with doing that, here's a howto on the community wiki: https://wiki.postgresql.org/wiki/Getting_a_stack_trace_of_a_running_PostgreSQL_backend_on_Linux/BSD > This has been some discussion before about making a change before the > 9.5beta1: > > https://www.postgresql.org/message-id/flat/9A28C8860F777E439AA12E8AEA7694F8010F6F3F%40BPXM15GP.gisp.nec.co.jp > > https://www.postgresql.org/message-id/flat/CAKJS1f_sxPyBHF6%3DnEYwPJdKKDNjVDP91b_EJApfyGTei%3DViDw%40mail.gmail.com > Both of those threads are about a hashjoin issue, which should have been fixed in 9.5. Moreover, you haven't shared the query and it's query plan, so it's unclear if it's doing hash joins at all. That would be useful for investigating this issue, BTW. > > postgresql 9.5.4 (2PGDG.rhel6) > work_mem = 256MB > FWIW you're missing more than a year of bugfixes regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services