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 1iXjsK-00038D-K6 for pgsql-bugs@arkaria.postgresql.org; Thu, 21 Nov 2019 10:39:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iXjsJ-0007K9-7M for pgsql-bugs@arkaria.postgresql.org; Thu, 21 Nov 2019 10:39:47 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1iXjsI-0007K2-VP for pgsql-bugs@lists.postgresql.org; Thu, 21 Nov 2019 10:39:47 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iXjsG-0000a2-7q for pgsql-bugs@lists.postgresql.org; Thu, 21 Nov 2019 10:39:46 +0000 Received: by mail-wm1-x341.google.com with SMTP id y5so3074460wmi.5 for ; Thu, 21 Nov 2019 02:39:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=cwDqYnME66KxJyBtuNxlB31Uor4iDraS6c5cm7ASgjg=; b=sewv+qUuqjOm+aRDgrsN/2AUYPKoEfsXJvxHmQE1PS/FM6KZIhrm0ROfJXPlYZHRt9 Rm6Rhfzc98Eoj+bcVxgjPZNK0AgiA8/hQhnIyS68mjxLBAsRi2l8f+jBSYI4nfhi0Hjx Ji5q0WItUYpsZCOHVnCuL6L7E0oHd/rPaAZXWgLIIKoYxF7zYdPTaJc9/3doutNxJHVm pPbR+olb53cSblFJ8Tr21+muWTifaWIzlwHfWXopI28dUF3EiVGbEs+nyXx5a/DJfECn 58G8LHSV+WFkENqyEs0uHRgy055KMk72ObcHfrrTinjto0RZPvHs540XNs79jdTa1+J5 oeZg== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=cwDqYnME66KxJyBtuNxlB31Uor4iDraS6c5cm7ASgjg=; b=t/ebm3ubGEPMNhdsoVEwEjauWrJ+3H+jUBwnkbERFLrDidh8yNOkFfscHeCF/JIL5O JPGIa84XcsfwRY7S+LRoj9pNA+inNK2aO3z9q6SROLC6JNVVuAtuDq0h5tbCo5BVt/v+ GhPcJsehE4MWiWmAqchvOdvJqhCbU163q4zp4VFkQ9SzfT1Lrj6hb+BsNwym3NJHWytf 0xa/KU/8IrS0s0WIZvhctzMix8Tz0V5uIcSF4letAA0P2jnL+hLp8HsRGdmhpov8dw3r ar/2NBDQQxru9tD/O7Yl9bdSGYDDHIZ1q8VifUIobXUaTXGdg/YVFsYVjKlukZjVpt2d zsWg== X-Gm-Message-State: APjAAAWuaKYlkkdWuOG07coFHoGjNRwoMXDE8JkBdXjk+w0SPBCecrwD PR6F0PqNwugm3bPGUZyvW+GLCg== X-Google-Smtp-Source: APXvYqzz7+EGck3MvSpgml8Vtja/PPKajdtrjJR6fDHCA0LoOz6eCELRCSP/gPjZ1+YwyTeAtexefg== X-Received: by 2002:a1c:f404:: with SMTP id z4mr9057122wma.12.1574332783190; Thu, 21 Nov 2019 02:39:43 -0800 (PST) Received: from localhost (ip-86-49-253-92.net.upcbroadband.cz. [86.49.253.92]) by smtp.gmail.com with ESMTPSA id w19sm2358939wmk.36.2019.11.21.02.39.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2019 02:39:42 -0800 (PST) Date: Thu, 21 Nov 2019 11:39:40 +0100 From: Tomas Vondra To: ienieghapheoghaiwida@xff.cz, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16129: Segfault in tts_virtual_materialize in logical replication worker Message-ID: <20191121103940.gpadc7xmssl63sad@development> References: <16129-a0c0f48e71741e5f@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <16129-a0c0f48e71741e5f@postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Nov 21, 2019 at 01:14:18AM +0000, PG Bug reporting form wrote: >The following bug has been logged on the website: > >Bug reference: 16129 >Logged by: Ondrej Jirman >Email address: ienieghapheoghaiwida@xff.cz >PostgreSQL version: 12.1 >Operating system: Arch Linux >Description: > >Hello, > >I've upgraded my main PostgreSQL cluster from 11.5 to 12.1 via pg_dumpall >method and after a while I started getting segfault in logical replication >worker. > >My setup is fairly vanilla, non-default options: > >shared_buffers = 256MB >work_mem = 512MB >temp_buffers = 64MB >maintenance_work_mem = 4GB >effective_cache_size = 16GB >max_logical_replication_workers = 30 >max_replication_slots = 30 >max_worker_processes = 30 >wal_level = logical > >I have several databases that I subscribe to from this database cluster >using logical replication. > >Replication of one of my databases (running on ARMv7 machine) started >segfaulting on the subscriber side (x86_64) like this: > >#0 0x00007fc259739917 in __memmove_sse2_unaligned_erms () from >/usr/lib/libc.so.6 >#1 0x000055d033e93d44 in memcpy (__len=620701425, __src=, >__dest=0x55d0356da804) at /usr/include/bits/string_fortified.h:34 >#2 tts_virtual_materialize (slot=0x55d0356da3b8) at execTuples.c:235 >#3 0x000055d033e94d32 in ExecFetchSlotHeapTuple >(slot=slot@entry=0x55d0356da3b8, materialize=materialize@entry=true, >shouldFree=shouldFree@entry=0x7fff0e7cf387) at execTuples.c:1624 Hmmm, so it's failing on this memcpy() in tts_virtual_materialize: else { Size data_length = 0; data = (char *) att_align_nominal(data, att->attalign); data_length = att_addlength_datum(data_length, att->attlen, val); memcpy(data, DatumGetPointer(val), data_length); slot->tts_values[natt] = PointerGetDatum(data); data += data_length; } The question is, which of the pointers is bogus. You seem to already have a core file, so can you inspect the variables in frame #2? I think especially p *slot p natt p val p *att would be interesting to see. Also, how does the replicated schema look like? Can we see the table definitions? regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services