Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iXxSl-0007Rg-0q for pgsql-bugs@arkaria.postgresql.org; Fri, 22 Nov 2019 01:10:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iXxSj-0002uc-2i for pgsql-bugs@arkaria.postgresql.org; Fri, 22 Nov 2019 01:10:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iXxSi-0002pI-IS for pgsql-bugs@lists.postgresql.org; Fri, 22 Nov 2019 01:10:16 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iXxSb-0000so-CY for pgsql-bugs@lists.postgresql.org; Fri, 22 Nov 2019 01:10:15 +0000 Received: by mail-wr1-x443.google.com with SMTP id b18so6652422wrj.8 for ; Thu, 21 Nov 2019 17:10:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=I5dwfv7o2stgo30pWjtssexwSppGcfsfKVc/W33STkg=; b=w/+d5T6CqGT+xDF+9wEuuc+AkfCfbvYzycwXfj86shA525vx5fPgR5K0WcbVVvqW1B 1HKfXjfeHD1RaWoGURI9bhyrWFAbQp7V+d7LlcaFcBPeHYUcandx6BDiwGDi6Vl5cw+y 5mAkk43+W/cYPvgLXiDlPLyrZF+1rO/yycGXvumHIGIRJT4WT8GCpmLUZxTIijd8q8R/ zHNrx5PUoKagQx8s46+RT5KNzIqtOpB0ZbjgoiNNFJU40VtGv7XaNMPt9hV4RM+sOoLr qgCjy4rRuvD9GsPPvdKDdB/q1q5kfo0fz9gPtBDEuWoVoXmneuTEIpCoKnJFN4KoBw5N aJfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=I5dwfv7o2stgo30pWjtssexwSppGcfsfKVc/W33STkg=; b=hKWUWgn2W0lZWy6LNTIGAS1uTJtiKYznEsJEsXw8fbwGYqtTiPhZ1aHqEyPwVQfv2w 6a59duiJYicix3+glVY9qwBtPW9ArIwLrVyWW/JfNLJvzUhDVroaVVvuM+RELC/G2RWx kdE+J+AKkrO4E5aTJUSVKiYoOA7WITuFIRhMR9o8NxJaJWbgpFmRBxOjyAIFLesur5mI +aoqPegwW1XhJzrMt0oOvp6KLFIf2Dz9Rbf379DCiO6n7Sk5w2uuypwcWkrHBMSL8e67 Z/1rrAUV0ISxvQdVcnzgD4Op9JzqySJhMwXIgQLW3Aon5/+zIR5sQZjb8Ryk29zzGs3l 2wZQ== X-Gm-Message-State: APjAAAUzww12thZCzk0gllp2GceqK9B8JxSLQEN86deW1QGCSmVzvcJB XLmVLH5N+DqHoFILZ+AsTt0tixWV5AA= X-Google-Smtp-Source: APXvYqwciM4xg3NtBNQBFS89lUG/2bw7F7jxe6zWVFvtM4uDpVPhr9zTrV0HQWIBLYMni51oKm8JyQ== X-Received: by 2002:a5d:6542:: with SMTP id z2mr15054894wrv.371.1574385007773; Thu, 21 Nov 2019 17:10:07 -0800 (PST) Received: from localhost (ip-86-49-253-92.net.upcbroadband.cz. [86.49.253.92]) by smtp.gmail.com with ESMTPSA id y6sm5502239wrn.21.2019.11.21.17.10.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2019 17:10:06 -0800 (PST) Date: Fri, 22 Nov 2019 02:10:05 +0100 From: Tomas Vondra To: Tom Lane Cc: =?utf-8?Q?Ond=C5=99ej?= Jirman , pgsql-bugs@lists.postgresql.org, Andres Freund Subject: Re: BUG #16129: Segfault in tts_virtual_materialize in logical replication worker Message-ID: <20191122011005.cxyqpaicoelwoep5@development> References: <20191121165752.dffge6bh756xlfdg@development> <20191121173555.midj6vp4dmiiqs24@core.my.home> <20191121185844.6qsqhwzzuhu3fpsg@core.my.home> <20191121214115.3tgefmvkmrzaim74@development> <20191121220854.ebdzjtloel56sfwu@development> <13122.1574375845@sss.pgh.pa.us> <20191121234701.2wtyc77zd5ux3myf@development> <14166.1574380607@sss.pgh.pa.us> <20191122001110.zfv45fkjiwkmli6s@development> <15667.1574382815@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <15667.1574382815@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Nov 21, 2019 at 07:33:35PM -0500, Tom Lane wrote: >Tomas Vondra writes: >> On Thu, Nov 21, 2019 at 06:56:47PM -0500, Tom Lane wrote: >>> "remoteslot" will contain its very own copy of the data, which >>> is then summarily freed by ExecClearSlot. > >> But remoteslot is virtual, so it calls tts_virtual_copyslot, not the >> heap one. And AFAIK tts_virtual_copyslot only copies contents of the >> tts_values/tts_isnull arrays. > >Really? > >static void >tts_virtual_copyslot(TupleTableSlot *dstslot, TupleTableSlot *srcslot) >{ > ... > /* make sure storage doesn't depend on external memory */ > tts_virtual_materialize(dstslot); >} > D'oh! I entirely missed that last call, for some reason. And yes, the new test does show we're using freed memory, the \x7F\x7F\x7F\x7F... pattern is pretty clear. It's a interesting it happens only with mismatching descriptors, though. (Which the OP does not have, AFAICS.) I wonder if this might be due to upstream being 11.6 ... >In any case, I sure hope that Andres hasn't made the different >versions of ExecCopySlot have different semantics --- if he has, >he's got some explaining to do. But at least on this point, >it looks to me like all three versions still satisfy the >semantics that were clearly defined previously (v11 and before): > >/* -------------------------------- > * ExecCopySlot > * Copy the source slot's contents into the destination slot. > * > * The destination acquires a private copy that will not go away > * if the source is cleared. > * > * The caller must ensure the slots have compatible tupdescs. > * -------------------------------- > */ > >I'm sad that we seem to have lost this specification comment, though. > True. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services