Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eHHff-0004c0-19 for pgsql-general@arkaria.postgresql.org; Tue, 21 Nov 2017 23:09:39 +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 1eHHfe-0005Cm-An for pgsql-general@arkaria.postgresql.org; Tue, 21 Nov 2017 23:09:38 +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 1eHHfd-0005Cc-Uh for pgsql-general@lists.postgresql.org; Tue, 21 Nov 2017 23:09:38 +0000 Received: from mail-it0-x235.google.com ([2607:f8b0:4001:c0b::235]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eHHfW-0005WL-3b for pgsql-general@postgresql.org; Tue, 21 Nov 2017 23:09:36 +0000 Received: by mail-it0-x235.google.com with SMTP id u132so4105396ita.0 for ; Tue, 21 Nov 2017 15:09:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=sD6CLjfzXs9ESOzW5cFu9L3d05IR20jZrXKqUE4LEB8=; b=HDgWnzbt+WDUouOWX/exD3t5wNVwaDuisx/BXCwupNX2JAAyerySQVa2k3kUNeaJNr Ge7Ob2dojAPshzr/nUenbLmfUzvt5/Z5mDUYFkgWTDpwh0uQihsMtAWgPgioW9gsRiJH 7jpTcMpiJjzbaVYsJ5Mz60zspLPsbvkS/XyarXSWtNIN4s9x6KPDivYBbf5nLpel2pys Udor0TMMbfCEId3RiVGDEPbU/AsYhBrsFVfPVUdiiCglSrRwRqlIa1ENrvAtwRhZpxVt RF8ws32aLu2DVOSJBv4v38nGViuKh2AeCvsbvZd7KqkNcbJwtHKXJm9wOzOhboM2dyF7 K49w== 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:mime-version :content-disposition:user-agent; bh=sD6CLjfzXs9ESOzW5cFu9L3d05IR20jZrXKqUE4LEB8=; b=T2z7G3tC1SsJhTKL6CQUFh3FWs4ZzNwuqcQTxg0VC903fe6idcD1aQOoZ8X8f5PHMh w3zlFEMRlYROZNQtD7m3D4HWlskYd9u+1p4lfisCTxSusPeSm1KXoyR64CN+jcOAWVZx dt+knJhYQqWBA7aCgw5hkDBx9pgsHlf7aH+BJIHpXr7y9gwYr7CSo6aGj/cnaqjUZoze ZDU1d0JsCe2/dIILAdqD3Ophl3jU8u1n8p1PLF4rVa+ozQ3MDsltjiEg29nJ3Lt2q97R +mNgfKtXv+pBdJrt1cut+uUvursGzie/ZwDjwvhufj/4tLlg0/o49Vx3ZTcK0AeCFMjU uDPg== X-Gm-Message-State: AJaThX66qzNRcA2YqQhibn+qJ4WzYHgAhVKdoYazgU5UlUuNUf6VaK80 YWr87VbBrWDoGRRfXlaSR8CFk/Lh4sU= X-Google-Smtp-Source: AGs4zMYYYD+fvuphC5A39PzBRZQGHfU0b3oGIE1bbzcaAcWlGbNxC0yiqjoCJPqjZaclLQu2A6KEjQ== X-Received: by 10.36.44.200 with SMTP id i191mr4134190iti.120.1511305768049; Tue, 21 Nov 2017 15:09:28 -0800 (PST) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id p134sm3927202iop.75.2017.11.21.15.09.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Nov 2017 15:09:27 -0800 (PST) Received: by pryzbyj (Postfix, from userid 1000) id D4AC3800FD9; Tue, 21 Nov 2017 17:09:26 -0600 (CST) Date: Tue, 21 Nov 2017 17:09:26 -0600 From: Justin Pryzby To: pgsql-general@postgresql.org Subject: backends stuck in "startup" Message-ID: <20171121230926.GA17194@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I'm sorry to report this previously reported problem is happening again, starting shortly after pg_upgrading a customer to PG10.1 from 9.6.5. As $subject: backends are stuck in startup for minutes at a time. I didn't strace this time, but I believe last time I saw one was waiting in a futex. postgres 25271 17665 0 16:54 ? 00:00:00 postgres: oooo oooo a.b.c.246(59980) startup postgres 27123 17665 0 16:55 ? 00:00:00 postgres: mmmmmmmm mmmmmmmm a.b.c.247(59919) startup postgres 27142 17665 0 16:55 ? 00:00:00 postgres: main main a.b.c.100(42892) startup postgres 27224 17665 0 16:56 ? 00:00:00 postgres: main main a.b.c.100(42898) startup postgres 27270 17665 0 16:56 ? 00:00:00 postgres: wwwwww wwwwww a.b.c.252(39760) startup postgres 27271 17665 0 16:56 ? 00:00:00 postgres: iiiiiii iiiiiii a.b.c.248(37224) startup postgres 27873 17665 0 16:58 ? 00:00:00 postgres: wwwwwwww wwwwwwww a.b.c.253(59667) startup postgres 30038 17665 0 17:00 ? 00:00:00 postgres: wwwwww wwwwww a.b.c.252(39780) startup postgres 30039 17665 0 17:00 ? 00:00:00 postgres: oooo oooo a.b.c.246(60014) startup postgres 30040 17665 0 17:00 ? 00:00:00 postgres: mmmmmmmm mmmmmmmm a.b.c.247(59951) startup postgres 30041 17665 0 17:00 ? 00:00:00 postgres: mmmmmmmm mmmmmmmm a.b.c.247(59952) startup postgres 30042 17665 0 17:00 ? 00:00:00 postgres: wwwwww wwwwww a.b.c.252(39788) startup postgres 30043 17665 0 17:00 ? 00:00:00 postgres: aaaaa aaaaa a.b.c.245(44819) startup postgres 30044 17665 0 17:00 ? 00:00:00 postgres: nnn nnn a.b.c.250(41317) startup postgres 30045 17665 0 17:00 ? 00:00:00 postgres: mmmmmm mmmmmm a.b.c.249(47876) startup postgres 30046 17665 0 17:00 ? 00:00:00 postgres: nnn nnn a.b.c.250(41320) startup postgres 30048 17665 0 17:00 ? 00:00:00 postgres: aaaaa aaaaa a.b.c.245(44834) startup postgres 30051 17665 0 17:00 ? 00:00:00 postgres: iiiiiii iiiiiii a.b.c.248(37244) startup postgres 30052 17665 0 17:00 ? 00:00:00 postgres: iiiiiii iiiiiii a.b.c.248(37247) startup postgres 30054 17665 0 17:00 ? 00:00:00 postgres: nnn nnn a.b.c.250(41327) startup postgres 30079 17665 0 17:00 ? 00:00:00 postgres: aaaaa aaaaa a.b.c.245(44843) startup postgres 30081 17665 0 17:00 ? 00:00:00 postgres: wwwwww wwwwww a.b.c.252(39790) startup postgres 30083 17665 0 17:00 ? 00:00:00 postgres: pppp pppp a.b.c.251(50397) startup postgres 30084 17665 0 17:00 ? 00:00:00 postgres: main main a.b.c.100(43074) startup postgres 30604 17665 0 17:02 ? 00:00:00 postgres: oooo oooo a.b.c.246(60018) startup postgres 30614 17665 0 17:02 ? 00:00:00 postgres: nnn nnn a.b.c.250(41331) startup postgres 30624 17665 0 17:02 ? 00:00:00 postgres: aaaaa aaaaa a.b.c.245(44847) startup postgres 30841 17665 0 17:03 ? 00:00:00 postgres: mmmmmmmm mmmmmmmm a.b.c.247(59961) startup postgres 31023 17665 0 17:03 ? 00:00:00 postgres: postgres main [local] startup postgres 31024 17665 0 17:03 ? 00:00:00 postgres: wwwwww wwwwww a.b.c.252(39796) startup I found these older, similar reports: https://www.postgresql.org/message-id/flat/4F9AC452.3050102%40pgexperts.com#4F9AC452.3050102@pgexperts.com https://www.postgresql.org/message-id/8896.1337998337%40sss.pgh.pa.us I saved ~40 cores from backends from the most recent incident, which are all essentially identical: (gdb) bt #0 0x0000003f6ee0d930 in ?? () #1 0x00007f19f3401258 in ?? () #2 0x00000000006a4440 in PGSemaphoreLock (sema=0x7f19f3401258) at pg_sema.c:310 #3 0x0000000000714495 in LWLockAcquire (lock=0x7f19f3404f80, mode=LW_SHARED) at lwlock.c:1233 #4 0x00000000006f75e5 in BufferAlloc (smgr=0x1f3bc48, relpersistence=112 'p', forkNum=MAIN_FORKNUM, blockNum=1, mode=RBM_NORMAL, strategy=0x0, hit=0x7fff6ef1c5af "") at bufmgr.c:1012 #5 ReadBuffer_common (smgr=0x1f3bc48, relpersistence=112 'p', forkNum=MAIN_FORKNUM, blockNum=1, mode=RBM_NORMAL, strategy=0x0, hit=0x7fff6ef1c5af "") at bufmgr.c:745 #6 0x00000000006f800e in ReadBufferExtended (reln=0x1ee6a08, forkNum=MAIN_FORKNUM, blockNum=1, mode=, strategy=) at bufmgr.c:664 #7 0x00000000004c090a in _bt_relandgetbuf (rel=0x1ee6a08, obuf=145, blkno=, access=1) at nbtpage.c:708 #8 0x00000000004c1284 in _bt_getroot (rel=0x1ee6a08, access=) at nbtpage.c:298 #9 0x00000000004c46eb in _bt_search (rel=0x1ee6a08, keysz=1, scankey=0x7fff6ef1d040, nextkey=0 '\000', bufP=0x7fff6ef1da4c, access=1, snapshot=0x1f1a648) at nbtsearch.c:103 #10 0x00000000004c5d1d in _bt_first (scan=0x1f1a4a8, dir=ForwardScanDirection) at nbtsearch.c:1028 #11 0x00000000004c39dd in btgettuple (scan=0x1f1a4a8, dir=ForwardScanDirection) at nbtree.c:372 #12 0x00000000004bcf1a in index_getnext_tid (scan=0x1f1a4a8, direction=) at indexam.c:541 #13 0x00000000004bcfca in index_getnext (scan=0x1f1a4a8, direction=ForwardScanDirection) at indexam.c:679 #14 0x00000000004bc549 in systable_getnext (sysscan=0x1f1ae68) at genam.c:422 #15 0x000000000080fac7 in SearchCatCache (cache=0x1ece848, v1=, v2=, v3=, v4=) at catcache.c:1178 #16 0x0000000000844e7d in superuser_arg (roleid=33320) at superuser.c:71 #17 0x0000000000832917 in InitPostgres (in_dbname=0x1e9eec8 "iiiiiii", dboid=0, username=0x1e71738 "iiiiiii", useroid=0, out_dbname=0x0) at postinit.c:742 #18 0x00000000007239f2 in PostgresMain (argc=1, argv=, dbname=0x1e9eec8 "iiiiiii", username=0x1e71738 "iiiiiii") at postgres.c:3735 #19 0x00000000006b7d7a in BackendRun (argc=, argv=) at postmaster.c:4357 #20 BackendStartup (argc=, argv=) at postmaster.c:4029 #21 ServerLoop (argc=, argv=) at postmaster.c:1753 #22 PostmasterMain (argc=, argv=) at postmaster.c:1361 #23 0x0000000000638ad0 in main (argc=3, argv=0x1e6f5b0) at main.c:228 (gdb) p *reln $2 = {rd_node = {spcNode = 1663, dbNode = 16405, relNode = 2679}... nep=# SELECT relname FROM pg_class WHERE oid=2679; relname | pg_index_indexrelid_index For the largest DB: main=# \dt+ pg_class|pg_attribute|pg_index pg_catalog | pg_attribute | table | postgres | 227 MB | pg_catalog | pg_class | table | postgres | 6752 kB | pg_catalog | pg_index | table | postgres | 3448 kB | During normal operation, after restarting following this incident: postgres=# SELECT COUNT(1) FROM pg_stat_activity; count | 85 shared_buffers | 2GB max_connections | 400 effective_cache_size | 4GB maintenance_work_mem | 512MB effective_io_concurrency | 2 max_locks_per_transaction | 64 max_parallel_workers_per_gather | 3 password_encryption | scram-sha-256 I can probably collect other diagnostics if needed, but otherwise it's possible I'll need to reload this DB under PG96. ..but, while this issue is occuring, I can't make simple queries (like SELECT * FROM pg_locks) Notes: - we DO use temp tables; it looks like we created up to 90 temp tables each hour; - we're still running analyze following yesterday's pg_upgrade; - I have a script saving something from pg_buffercache, but it doesn't appear to be running during this last incident; - I'm planning do disable sync seqscan for the night (although as I understand that may not matter (?)) - this instance has clients connecting to ~10 DBs; Thanks in advance Justin