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 1f0B1y-0001q5-FV for pgsql-committers@arkaria.postgresql.org; Sun, 25 Mar 2018 19:10:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f0B1x-0001iJ-3l for pgsql-committers@arkaria.postgresql.org; Sun, 25 Mar 2018 19:10:13 +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.89) (envelope-from ) id 1f0B1w-0001hd-Rd for pgsql-committers@lists.postgresql.org; Sun, 25 Mar 2018 19:10:12 +0000 Received: from mail.thelabyrinth.net ([45.56.70.56]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f0B1q-00089z-4X for pgsql-committers@lists.postgresql.org; Sun, 25 Mar 2018 19:10:11 +0000 Received: from Davids-iMac.local (unknown [173.169.74.224]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dsteele) by mail.thelabyrinth.net (Postfix) with ESMTPSA id 763645466C; Sun, 25 Mar 2018 19:10:04 +0000 (UTC) Subject: Re: pgsql: Exclude unlogged tables from base backups To: Tom Lane , Teodor Sigaev Cc: pgsql-committers@lists.postgresql.org References: <14453.1522001792@sss.pgh.pa.us> From: David Steele Message-ID: <8d57c3ba-d44b-a8eb-7a91-c0b6156240fd@pgmasters.net> Date: Sun, 25 Mar 2018 15:10:03 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <14453.1522001792@sss.pgh.pa.us> Content-Type: multipart/mixed; boundary="------------5C7E0390BA284CF337A13E84" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------5C7E0390BA284CF337A13E84 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 3/25/18 2:16 PM, Tom Lane wrote: > Teodor Sigaev writes: >> Exclude unlogged tables from base backups > > Buildfarm member skink (valgrind) has reported this during its last couple > of runs: > > 2018-03-24 03:18:23.409 UTC [17302] 010_pg_basebackup.pl LOG: received replication command: BASE_BACKUP LABEL 'pg_basebackup base backup' NOWAIT TABLESPACE_MAP > ==17302== VALGRINDERROR-BEGIN > ==17302== Conditional jump or move depends on uninitialised value(s) > ==17302== at 0x4C2FD88: strlen (vg_replace_strmem.c:458) > ==17302== by 0x6FBA3AB: vfprintf (vfprintf.c:1643) > ==17302== by 0x6FE19AF: vsnprintf (vsnprintf.c:114) > ==17302== by 0x6FC0F6E: snprintf (snprintf.c:33) > ==17302== by 0x4A3C97: sendDir (basebackup.c:1060) > ==17302== by 0x4A40C6: sendDir (basebackup.c:1221) > ==17302== by 0x4A52B2: sendTablespace (basebackup.c:937) > ==17302== by 0x4A5740: perform_base_backup (basebackup.c:313) > ==17302== by 0x4A635C: SendBaseBackup (basebackup.c:710) > ==17302== by 0x49FCF2: exec_replication_command (walsender.c:1520) > ==17302== by 0x4F61CE: PostgresMain (postgres.c:4143) > ==17302== by 0x4712ED: BackendRun (postmaster.c:4409) > ==17302== Uninitialised value was created by a stack allocation > ==17302== at 0x4A38EA: sendDir (basebackup.c:957) > ==17302== > ==17302== VALGRINDERROR-END > 2018-03-24 03:18:26.127 UTC [17302] 010_pg_basebackup.pl DEBUG: contents of directory "pg_serial" excluded from backup > > I might be wrong to blame that on this patch, but nothing else has > touched basebackup.c lately. Sure looks like it deserves the blame -- the error is occurring right in the new code. I think skink is using large values for rel oids and that has exposed a bug. The strncpy doesn't zero terminate the string if the oid has the max number of characters. At least, I was able to reproduce under those circumstances. The attached should fix it. Regards, -- -David david@pgmasters.net --------------5C7E0390BA284CF337A13E84 Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0"; name="basebackup.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="basebackup.patch" ZGlmZiAtLWdpdCBhL3NyYy9iYWNrZW5kL3JlcGxpY2F0aW9uL2Jhc2ViYWNrdXAuYyBiL3Ny Yy9iYWNrZW5kL3JlcGxpY2F0aW9uL2Jhc2ViYWNrdXAuYwppbmRleCBlYjZlYjcyMDZkLi5l MzY4OTQzNDk0IDEwMDY0NAotLS0gYS9zcmMvYmFja2VuZC9yZXBsaWNhdGlvbi9iYXNlYmFj a3VwLmMKKysrIGIvc3JjL2JhY2tlbmQvcmVwbGljYXRpb24vYmFzZWJhY2t1cC5jCkBAIC0x MDU2LDYgKzEwNTYsNyBAQCBzZW5kRGlyKGNvbnN0IGNoYXIgKnBhdGgsIGludCBiYXNlcGF0 aGxlbiwgYm9vbCBzaXplb25seSwgTGlzdCAqdGFibGVzcGFjZXMsCiAJCQkJICogSWYgYW55 IG90aGVyIHR5cGUgb2YgZm9yaywgY2hlY2sgaWYgdGhlcmUgaXMgYW4gaW5pdCBmb3JrCiAJ CQkJICogd2l0aCB0aGUgc2FtZSBPSUQuIElmIHNvLCB0aGUgZmlsZSBjYW4gYmUgZXhjbHVk ZWQuCiAJCQkJICovCisJCQkJbWVtc2V0KHJlbE9pZCwgMCwgc2l6ZW9mKHJlbE9pZCkpOwog CQkJCXN0cm5jcHkocmVsT2lkLCBkZS0+ZF9uYW1lLCByZWxPaWRDaGFycyk7CiAJCQkJc25w cmludGYoaW5pdEZvcmtGaWxlLCBzaXplb2YoaW5pdEZvcmtGaWxlKSwgIiVzLyVzX2luaXQi LAogCQkJCQkJIHBhdGgsIHJlbE9pZCk7Cg== --------------5C7E0390BA284CF337A13E84--