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 1eoFZw-0007jl-Lu for pgsql-bugs@arkaria.postgresql.org; Tue, 20 Feb 2018 21:36:00 +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 1eoFZv-0005TC-7Z for pgsql-bugs@arkaria.postgresql.org; Tue, 20 Feb 2018 21:35:59 +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 1eoFZu-0005T1-GX for pgsql-bugs@lists.postgresql.org; Tue, 20 Feb 2018 21:35:59 +0000 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eoFZr-0007WB-GO for pgsql-bugs@postgresql.org; Tue, 20 Feb 2018 21:35:57 +0000 Received: by mail-wr0-x241.google.com with SMTP id w77so18470692wrc.6 for ; Tue, 20 Feb 2018 13:35:55 -0800 (PST) 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=sy4wO83+l0bO4dZf6BTvlEDhM9ybCjeGBXpvCwMTMiM=; b=L9r78JMekDBBzN8z2xeujtabCSikwiU9FZ7tBvBKxIz4bSDM7VJnKbHetzZOCHN6gz ScBtrIKYXQttXOoPBAqGe1lLtOfrHDY4IL/vk+mR5UGRcK/xhXmib8uP/SWgpQCGRMff REpc0i+aIqtwoNbGuKg4RlQzSxCh7aJbbZH2Mf9Zo9nzJrNtLQdL5IPgaYk4TcGq0Dbx oMhAGVtY8pm8nyN1R6fsUaap3CV4NReJ15Tw6ijMx8vnBEnkgQUYimMLMf7TzfpftXGO ItMDzUirHzUzeNX9jSAYB3M5vPv8USe+3o9A5mP968mKzdWG1tFydo6X6UmLVRt44Fm1 uNCQ== 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=sy4wO83+l0bO4dZf6BTvlEDhM9ybCjeGBXpvCwMTMiM=; b=a9NHmNPZzBXmuvSCBkjujW17Y7VhmLAksy1bSkZuP9ubnhz+u0qreszUQYUwdNxFD5 63QUYgHSaYCVOrvh1ylSH6U2ZingGtIEoC5Rz29jXISawV1WwRC0ZSZ5d8Y/fBYnD7em U6uunWqAdInoh1TdpWJxRl9MbhKHsB+28kHpokvsEt7m3vzDnh3KEK7S+99iMuW7bmOv 6q9HmxfU0awWiiT3VnodUMAxfTAbIilLljt4GXw1LSer2T9N+T7kTGg6+4A6IAOqaKiC MUfG8g/Ssh5DPmzF0ON26JkazoU3cjKntsuIHcb/BMEe7Ox56BqyMchwT3VaV3Nl/GHR J1aA== X-Gm-Message-State: APf1xPBaAVc/FdCeOB9TPu3xKENtXsq6oJ08RLEq0soYbH/ovbr92QcE hPYm6S6hlhpxFSgA3+QhC1QSCdG3jm625R23MpiApOiMWmR/zK8Ng2jby1rkIxC7TxIv11RNXw1 4dQ0mSAysx+ipd/LsucYwicEmtkwANyuG35xjwEwywnwyWatB7X+zWhQaOij8s7RL723tE/otcV ei0gMv X-Google-Smtp-Source: AH8x225iRtSQiRuI1CbElAaRfUiBmsaW5m5ee0VgnGQCO/dd1Kzx84CNvxajTh3PkNiiScGbfBSIWw== X-Received: by 10.28.132.203 with SMTP id g194mr312314wmd.77.1519162553049; Tue, 20 Feb 2018 13:35:53 -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 67sm27366376wmg.13.2018.02.20.13.35.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Feb 2018 13:35:52 -0800 (PST) Subject: Re: Segmentation Fault in logical decoding get/peek API To: Andres Freund , Sudalai Cc: pgsql-bugs@postgresql.org References: <1519042814659-0.post@n3.nabble.com> <20180220175530.6ib4b3ngzkipekgs@alap3.anarazel.de> From: Tomas Vondra Message-ID: Date: Tue, 20 Feb 2018 22:35:50 +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: <20180220175530.6ib4b3ngzkipekgs@alap3.anarazel.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 02/20/2018 06:55 PM, Andres Freund wrote: > Hi, > > On 2018-02-19 05:20:14 -0700, Sudalai wrote: >> PostgreSQL backend crashing with segmentation fault 11, while consuming big >> transaction changes using pg_logical_slot_(peek|get)_changes. We are using >> postgresql version 9.5.10. > > Just to be sure, could you check that 9.5.11 shows the same problem? > >> About the big transaction : pg_xlog_dump shows 161426 records, and it spread >> across 3 WAL files. >> >> BackTace of the backend : >> >> Program received signal SIGSEGV, Segmentation fault. >> ReorderBufferCommit (rb=0xd17dc8, xid=, >> commit_lsn=7224098593984, end_lsn=, commit_time=> optimized out>, origin_id=, origin_lsn=0) at >> /home/test/compile/../postgresql-9.5.10/src/backend/replication/logical/reorderbuffer.c:1380 This very much seems like a custom PostgreSQL build (judging by the paths in the backtrace), so I wonder what configure options were used. It's not clear if this is a production of testing evironment, but if you could rebuild with debugging symbols / without optimizations, that would be helpful (it would get rid of some of the "optimized out" stuff). >> 1380 change->action = REORDER_BUFFER_CHANGE_INSERT; >> Hmmm, this would mean it's failing here: case REORDER_BUFFER_CHANGE_INTERNAL_SPEC_CONFIRM: /* * Confirmation for speculative insertion arrived. Simply * use as a normal record. It'll be cleaned up at the end * of INSERT processing. */ Assert(specinsert->data.tp.oldtuple == NULL); change = specinsert; change->action = REORDER_BUFFER_CHANGE_INSERT; And if it's segfaulting, it has to mean specinsert is NULL. So either we never got REORDER_BUFFER_CHANGE_INTERNAL_SPEC_INSERT, or we threw it away in the "change_done" part. Seems strange in both cases. Sudalai, are you using speculative inserts in the transaction? regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services