Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e3iI0-0005Xu-MB for pgsql-hackers@arkaria.postgresql.org; Sun, 15 Oct 2017 12:45:09 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1e3iI0-0006XR-8y for pgsql-hackers@arkaria.postgresql.org; Sun, 15 Oct 2017 12:45:08 +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 1e3iHz-0006Wr-HR for pgsql-hackers@postgresql.org; Sun, 15 Oct 2017 12:45:07 +0000 Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1e3iHv-00089G-Ga for pgsql-hackers@postgresql.org; Sun, 15 Oct 2017 12:45:06 +0000 Received: by mail-wm0-x232.google.com with SMTP id l68so29101532wmd.5 for ; Sun, 15 Oct 2017 05:45:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=4tup9ZeJlZZDkT0Bw8mFVQXmAyAeI5NCegTmOojbgjg=; b=kw28nKGEGYk9bmZlRN2uQFn5TJ5BIKN9/oyHBS+Jh8wQjIjsQONlkbXPbSEQpO5/IB +e9ZCLZZkyT8fOn05rYC7ceevjewtbWM1xefHHvfmou9BANx6idq/b5RncTj5RMyOmtk gkvibrgnIA2DAOVRLgDREGR+bULkwnU4G4TcJyk5aDKKqBF9Bh6ezR9ro0X7RTFme2bs 2KpTNMAvpmwayy5IPMA8PrPvr/QybqAhkfWbP6OQ+va+haAoUjynOICa3FUJR36xETa6 e/bODMEel1FaE3E3QZPC+i1FzzgI9w0EOy70I7vE7UR+fBYkBUiQPXhW7CzOiMKE3cO3 8zig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=4tup9ZeJlZZDkT0Bw8mFVQXmAyAeI5NCegTmOojbgjg=; b=gIKjmw8tzZIhstoKkWVWaUaUrRo9aAd751FNPwMWQLw69qbB2h+TsKyn7VHI4VB6+f y+B5oLrnQLt59d0BwkDlvEL8/NdWEWDlotLHE9nlaA+EJAgEsC5LExfVMHafGxVWSkzx mBsrN2rV6FoA+JaYnYzeu3hAAnXg3WJdVdx2RkjPRwjBWXHgmqBbK60gepRK5LNUyUxc YU+iEikdRxvXMYklElrGL3lSfjn+fjzkXcpAJ+96yCGLWrWg3bV1lDxxgH3V3kpFm+7L DlRgGN3/Uy1V3m9LfZMBFFWtszEil0ALkEN2jQlEEr2xwI5zlrq7AEmsI45lQSMSQCTL /3Ow== X-Gm-Message-State: AMCzsaXm08Ca3Dtdg69/OAvdLoIAAyO/MDgRlKeYRH1vMytnEkG6AUSD q09Uk9rQO8z8ujo9jdi4teBvNg== X-Google-Smtp-Source: ABhQp+SVFFk5PUvN4CLom5G6Jt9TlOjVtpHbO7MIFMDLxPd3CM0UxH/FzT9csBDaK/VEFSRV85iqWg== X-Received: by 10.80.218.72 with SMTP id a8mr5742253edk.221.1508071502073; Sun, 15 Oct 2017 05:45:02 -0700 (PDT) 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 w51sm3977568edd.60.2017.10.15.05.45.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Oct 2017 05:45:01 -0700 (PDT) Subject: Re: SIGSEGV in BRIN autosummarize To: Justin Pryzby Cc: pgsql-hackers@postgresql.org, Alvaro Herrera References: <20171014035732.GB31726@telsasoft.com> <20171014224220.GB22678@telsasoft.com> <74e6535c-4a96-6a3f-1e04-3068106c6f59@2ndquadrant.com> <20171015015656.GC22678@telsasoft.com> From: Tomas Vondra Message-ID: Date: Sun, 15 Oct 2017 14:44:58 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20171015015656.GC22678@telsasoft.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Hi, On 10/15/2017 03:56 AM, Justin Pryzby wrote: > On Fri, Oct 13, 2017 at 10:57:32PM -0500, Justin Pryzby wrote: ... >> It's a bit difficult to guess what went wrong from this backtrace. For >> me gdb typically prints a bunch of lines immediately before the frames, >> explaining what went wrong - not sure why it's missing here. > > Do you mean this ? > > ... > Loaded symbols for /lib64/libnss_files-2.12.so > Core was generated by `postgres: autovacuum worker process gtt '. > Program terminated with signal 11, Segmentation fault. > #0 pfree (pointer=0x298c740) at mcxt.c:954 > 954 (*context->methods->free_p) (context, pointer); > Yes. So either 'context' is bogus. Or 'context->methods' is bogus. Or 'context->methods->free_p' is bogus. >> Perhaps some of those pointers are bogus, the memory was already pfree-d >> or something like that. You'll have to poke around and try dereferencing >> the pointers to find what works and what does not. >> >> For example what do these gdb commands do in the #0 frame? >> >> (gdb) p *(MemoryContext)context > > (gdb) p *(MemoryContext)context > Cannot access memory at address 0x7474617261763a20 > OK, this means the memory context pointer (tracked in the header of a chunk) is bogus. There are multiple common ways how that could happen: * Something corrupts memory (typically out-of-bounds write). * The pointer got allocated in an incorrect memory context (which then was released, and the memory was reused for new stuff). * It's a use-after-free. * ... various other possibilities ... > > I uploaded the corefile: > http://telsasoft.com/tmp/coredump-postgres-autovacuum-brin-summarize.gz > Thanks, but I'm not sure that'll help, at this point. We already know what happened (corrupted memory), we don't know "how". And core files are mostly just "snapshots" so are not very useful in answering that :-( regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers