Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eJJXe-0006dt-5a for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Nov 2017 13:33:46 +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 1eJJXd-0007Va-Oq for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Nov 2017 13:33:45 +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 1eJJXd-0007VO-BY for pgsql-hackers@lists.postgresql.org; Mon, 27 Nov 2017 13:33:45 +0000 Received: from mail-it0-x22a.google.com ([2607:f8b0:4001:c0b::22a]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eJJXZ-0007qE-F7 for pgsql-hackers@postgresql.org; Mon, 27 Nov 2017 13:33:44 +0000 Received: by mail-it0-x22a.google.com with SMTP id m191so20986958itg.2 for ; Mon, 27 Nov 2017 05:33:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=yPVtaaNVbdheNsXO03gnQhevuqvqsJ6FCSAqetQAM7E=; b=vFmp7l8Rxj/7tJUtjKbyBhB9EfO/VCsu7sUQLQ/opo3krPdQRQIoOGWVy1Z0J37yt0 klB/W5ZZ+D8riYzk3HlMrvK2ijMla+Ja5crNYh7hsFjCCKiWYzft3Dv7A8SYLU4mXWRh t06YDhJWR6hBpywBqTVRfae9qzJURRpaxFvS/z4vnAi4qJhHIfXFtSxxHpNDpFSFZKJi C/0rnE/7SzYIMOADcpJKgEn5HaCNvzKvesrk2g3EGiUiggpCAdL+tl/azQ4x+jjPOhdt oRHbnTO/np0vkaAPJkg4mySploJCf5KcPE9pITMhSHsVCuxrli0ocDEHJ4BudMGXmh2k LJLA== 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:user-agent; bh=yPVtaaNVbdheNsXO03gnQhevuqvqsJ6FCSAqetQAM7E=; b=NsluBCQDEE9PHIbyqN+4ouqh4Zan8sml/jSyGFerKF66w5J4JYroSOruIG4OZF8VMO TaR7KagMye6kspH2iExQ4c/ztruFrfpUve9o9/2rz24UDgjaNcAlv9tVdZ6bXeAYn/bd FU7jLVPCrYkcmFQuQioj9mYmxIS3fh7wRUWv5JoHry/rPb7VCFsVJMXIi2mjZ3Ajob0u 98bqCY6VHRivuPiZMbKHb/HE84Dhs+mHMnmiUn40VAZZ/43sT2q1E9DXUHgqNEypIF4l sJRYL1C+TmHNUxyB3uh8ojwpm4QJfCJFPwZIkRrdBcENJtxWO02KvnvNSN4QMftDm5Xx d1dA== X-Gm-Message-State: AJaThX7/+UBdPXG2LFaCEuBFNBhst8jKGDRYjNwcNspp6IqB1LsqUXzr Vp5UH0xf9p7EeLhXOoQ5OWMCdQ== X-Google-Smtp-Source: AGs4zMaJR+CSfjY60jotFcQ4ppNF5ChmG2OlfUXMQfcDdlyMpm0y0swKRsPRcRZCYQ2/KfE7KHCRbg== X-Received: by 10.36.40.194 with SMTP id h185mr29934372ith.101.1511789620139; Mon, 27 Nov 2017 05:33:40 -0800 (PST) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id j20sm2390107ioo.37.2017.11.27.05.33.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Nov 2017 05:33:39 -0800 (PST) Received: by pryzbyj (Postfix, from userid 1000) id 9EBDF80102B; Mon, 27 Nov 2017 07:33:38 -0600 (CST) Date: Mon, 27 Nov 2017 07:33:38 -0600 From: Justin Pryzby To: Alvaro Herrera Cc: pgsql-hackers@postgresql.org Subject: Re: PG10.1 autovac killed building extended stats Message-ID: <20171127133338.GC19405@telsasoft.com> References: <20171117152714.GA25754@telsasoft.com> <20171117163600.d7zsm2odaizikdhs@alvherre.pgsql> <20171117214352.GE25796@telsasoft.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="EeQfGwPcQSOJBaQU" Content-Disposition: inline In-Reply-To: <20171117214352.GE25796@telsasoft.com> User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --EeQfGwPcQSOJBaQU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Nov 17, 2017 at 03:43:52PM -0600, Justin Pryzby wrote: > On Fri, Nov 17, 2017 at 01:36:00PM -0300, Alvaro Herrera wrote: > > Justin Pryzby wrote: > > > > > Core was generated by `postgres: autovacuum worker process gtt '. > > > Program terminated with signal 11, Segmentation fault. > > > #0 statext_ndistinct_build (totalrows=300, numrows=300, rows=0x21df3e8, attrs=, stats=0x0) at mvdistinct.c:103 > > > 103 item->attrs = bms_add_member(item->attrs, > > > > > > (gdb) p stats > > > $5 = (VacAttrStats **) 0x0 > > > => This is an error, no ?? > > > > Not necessarily, but then I think this previous code is busted: > > > If I recall things correctly, the "continue" should be executed > > regardless of IsAutoVacuumWorkerProcess() (only the log should be > > conditional on that). I'm not sure how I arrived at the current coding, > > which I added in bf2a691e02d7 -- probably just fuzzy thinking. > > Is it useful to run with that change ? FYI: the affected server ran without crashing since Nov 18 with this change. --- postgresql-10.1.orig/src/backend/statistics/extended_stats.c 2017-11-06 20:46:52.000000000 -0400 +++ postgresql-10.1/src/backend/statistics/extended_stats.c 2017-11-18 18:23:44.057988419 -0400 @@ -98,20 +98,21 @@ if (!stats && !IsAutoVacuumWorkerProcess()) { ereport(WARNING, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), errmsg("statistics object \"%s.%s\" could not be computed for relation \"%s.%s\"", stat->schema, stat->name, get_namespace_name(onerel->rd_rel->relnamespace), RelationGetRelationName(onerel)), errtable(onerel))); - continue; } + if (!stats) + continue; /* check allowed number of dimensions */ Assert(bms_num_members(stat->columns) >= 2 && bms_num_members(stat->columns) <= STATS_MAX_DIMENSIONS); /* compute statistic of each requested type */ foreach(lc2, stat->types) { char t = (char) lfirst_int(lc2); Justin --EeQfGwPcQSOJBaQU Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=mvstats-continue --- postgresql-10.1.orig/src/backend/statistics/extended_stats.c 2017-11-06 20:46:52.000000000 -0400 +++ postgresql-10.1/src/backend/statistics/extended_stats.c 2017-11-18 18:23:44.057988419 -0400 @@ -98,20 +98,21 @@ if (!stats && !IsAutoVacuumWorkerProcess()) { ereport(WARNING, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), errmsg("statistics object \"%s.%s\" could not be computed for relation \"%s.%s\"", stat->schema, stat->name, get_namespace_name(onerel->rd_rel->relnamespace), RelationGetRelationName(onerel)), errtable(onerel))); - continue; } + if (!stats) + continue; /* check allowed number of dimensions */ Assert(bms_num_members(stat->columns) >= 2 && bms_num_members(stat->columns) <= STATS_MAX_DIMENSIONS); /* compute statistic of each requested type */ foreach(lc2, stat->types) { char t = (char) lfirst_int(lc2); --EeQfGwPcQSOJBaQU--