Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eWk0m-0002TS-Pa for pgsql-committers@arkaria.postgresql.org; Wed, 03 Jan 2018 14:27:20 +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 1eWk0k-0002Fb-Ms for pgsql-committers@arkaria.postgresql.org; Wed, 03 Jan 2018 14:27:18 +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 1eWk0k-0002FR-DP for pgsql-committers@lists.postgresql.org; Wed, 03 Jan 2018 14:27:18 +0000 Received: from smtprelay0038.b.hostedemail.com ([64.98.42.38] helo=smtprelay.b.hostedemail.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eWk0c-000497-Sf for pgsql-committers@postgresql.org; Wed, 03 Jan 2018 14:27:16 +0000 Received: from filter.hostedemail.com (10.5.19.248.rfc1918.com [10.5.19.248]) by smtprelay06.b.hostedemail.com (Postfix) with ESMTP id EE4DE8D016; Wed, 3 Jan 2018 14:27:04 +0000 (UTC) X-Session-Marker: 616C76686572726540616C76682E6E6F2D69702E6F7267 X-Spam-Summary: 10,1,0,,d41d8cd98f00b204,alvherre@alvh.no-ip.org,:::::,RULES_HIT:41:355:379:599:871:967:968:973:988:989:1260:1311:1312:1313:1314:1345:1359:1437:1515:1516:1518:1519:1535:1541:1575:1594:1595:1596:1711:1730:1747:1764:1777:1792:2198:2199:2393:2525:2561:2564:2682:2685:2693:2731:2859:2896:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:4605:4699:5007:6261:6748:7281:7903:8660:8957:9025:9121:10007:10400:10848:10967:11232:11604:11658:11914:12043:12740:12895:13071:13148:13230:13439:13894:13895:14180:14181:14658:14721:21063:21080:21324:21325:21451:21611:21627:30012:30054:30080:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:1:0,LFtime:3,LUA_SUMMARY:none X-HE-Tag: copy42_5aa9c14fb1552 X-Filterd-Recvd-Size: 5100 Received: from alvin.alvh.no-ip.org (unknown [179.57.113.18]) (Authenticated sender: alvherre@alvh.no-ip.org) by omf09.b.hostedemail.com (Postfix) with ESMTPA; Wed, 3 Jan 2018 14:27:02 +0000 (UTC) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 66F1268A; Wed, 3 Jan 2018 11:27:00 -0300 (-03) Date: Wed, 3 Jan 2018 11:27:00 -0300 From: Alvaro Herrera To: Andres Freund Cc: Jeff Janes , pgsql-committers@postgresql.org Subject: Re: pgsql: Fix deadlock hazard in CREATE INDEX CONCURRENTLY Message-ID: <20180103142700.sgbdcjx5fjajqj4h@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="jv4db6vu2dvcufcq" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180103034445.t3utrtrnrevfsghm@alap3.anarazel.de> User-Agent: NeoMutt/20170306-137-4415bd-dirty (1.8.0) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --jv4db6vu2dvcufcq Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit Hello, Andres Freund wrote: > On 2018-01-03 02:20:14 +0000, Alvaro Herrera wrote: > > Include an isolationtester spec that 8 out of 10 times reproduces the > > deadlock with the unpatched code for me (Álvaro). > > The isolation test doesn't appear to be fully stable: > > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=baiji&dt=2018-01-03%2003%3A00%3A01 Yeah, thanks for reporting that. It's annoying, but obvious in hindsight -- the second process occasionally gets stuck waiting for the first one to release its snapshot. I can reproduce this about half the time, by adding a 100ms sleep in ProcessUtilitySlow right after the DefineIndex call. I can turn the isolation test to produce the output where s2 waits (without the sleep) if I introduce a third session s3 to lock s2; then releasing the lock in s3 causes both s1 and s2 to complete. I think the completions would be reported always in that order because of the way isolationtester verifies suspension. However this means that the test will get removed in 9.4 and 9.5 because isolationtester is not smart enough there. I suppose the other option would be to add an alternate expected file for the test. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services --jv4db6vu2dvcufcq Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-Fix-isolation-test-to-be-less-timing-dependent.patch"