Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 3BFBA10BF35E for ; Mon, 30 Jan 2012 23:01:02 -0400 (AST) Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Rs3xk-0006qv-Ns for pgsql-bugs@postgresql.org; Tue, 31 Jan 2012 03:01:01 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id q0V30a9D023551; Mon, 30 Jan 2012 22:00:36 -0500 (EST) To: Bridget Frey cc: Robert Haas , Michael Brauwerman , Peter Geoghegan , pgsql-bugs@postgresql.org Subject: Re: BUG #6200: standby bad memory allocations on SELECT In-reply-to: References: Comments: In-reply-to Bridget Frey message dated "Mon, 30 Jan 2012 13:59:08 -0800" Date: Mon, 30 Jan 2012 22:00:36 -0500 Message-ID: <23550.1327978836@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201201/261 X-Sequence-Number: 32328 Bridget Frey writes: > The second error is an invalid memory alloc error that we're getting ~2 > dozen times per day in production. The bt for this alloc error is below. This trace is consistent with the idea that we're getting a corrupt tuple out of a table, although it doesn't entirely preclude the possibility that the corrupt value is manufactured inside the backend. To get much further you're going to need to look at the specific query being executed each time this happens, and see if you can detect any pattern. Now that you've got debug symbols straightened out, the gdb command "p debug_query_string" should accomplish this. (If that does not produce anything that looks like one of your application's SQL commands, we'll need to try harder to extract the info.) You could probably hack the elog(PANIC) to log that before dying, too, if you'd rather not manually gdb each core dump. regards, tom lane