Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1de86B-0007Bk-CC for pgsql-bugs@arkaria.postgresql.org; Sat, 05 Aug 2017 23:03:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1de86A-0004jy-U7 for pgsql-bugs@arkaria.postgresql.org; Sat, 05 Aug 2017 23:03:10 +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 1de86A-0004jS-4W for pgsql-bugs@postgresql.org; Sat, 05 Aug 2017 23:03:10 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1de867-0006Vm-BJ for pgsql-bugs@postgresql.org; Sat, 05 Aug 2017 23:03:08 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 7F251213F5; Sat, 5 Aug 2017 19:03:06 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Sat, 05 Aug 2017 19:03:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=HIpKgzFBFsbHP+rvIS Ykygd/scMMkmZSJM+B0AqYbOM=; b=Fgp4Qdw4u4wg5zXgaco0WpPuOOyzLMA+5T GChzFXDEhykUhIXBl+oS7Uj2zG0JSnBpPPVGA/0mOg5sX10SwZSwWo1BQvYdJMvq 1PHrswIqfTh4+/1MSFwcp6lFmiPh7+fM4xT06JpsWjjn1ha9DHkp/cOcPOBwdfFI Q1EbL7trW9F/7w3mg3NB19Ea+xdkSuzZBr0abcjoFNFkTPKenh7WcX/74U4RVa/L x+5O2E+qVNSe29PeLOFp/SmCozct/x5o5m0eE/IofB3gzlBeysogUM57j5dzibrz QWWj/Bedjush75Mca8TK4JIwinAWZSutxw7lJCmCZvJitLw+KePg== X-ME-Sender: X-Sasl-enc: uPVY47pe7G4GOC23HKg7I0GL9DzFaf7HvwuWXO0U2B6o 1501974186 Received: from intern.anarazel.de (unknown [208.71.159.84]) by mail.messagingengine.com (Postfix) with ESMTPA id 156DA7FA6E; Sat, 5 Aug 2017 19:03:06 -0400 (EDT) Date: Sat, 5 Aug 2017 16:03:02 -0700 From: Andres Freund To: Peter Geoghegan Cc: Daniel Verite , PostgreSQL mailing lists , Peter Eisentraut Subject: Re: Crash report for some ICU-52 (debian8) COLLATE and work_mem values Message-ID: <20170805230302.yy3uf6emcwe5ytsw@alap3.anarazel.de> References: <71cd77ab-a421-443f-8536-821be9bd15ed@manitou-mail.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 2017-08-03 11:42:25 -0700, Peter Geoghegan wrote: > On Thu, Aug 3, 2017 at 8:49 AM, Daniel Verite wrote: > > With query #2 it ends up crashing after ~5hours and produces > > the log in log-valgrind-2.txt.gz with some other entries than > > case #1, but AFAICS still all about reading uninitialised values > > in space allocated by datumCopy(). > > Right. This part is really interesting to me: > > ==48827== Uninitialised value was created by a heap allocation > ==48827== at 0x4C28C20: malloc (vg_replace_malloc.c:296) > ==48827== by 0x80B597: AllocSetAlloc (aset.c:771) > ==48827== by 0x810ADC: palloc (mcxt.c:862) > ==48827== by 0x72BFEF: datumCopy (datum.c:171) > ==48827== by 0x81A74C: tuplesort_putdatum (tuplesort.c:1515) > ==48827== by 0x5E91EB: advance_aggregates (nodeAgg.c:1023) > > If you actually go to datum.c:171, you see that that's a codepath for > pass-by-reference datatypes that lack a varlena header. Text is a > datatype that has a varlena header, though, so that's clearly wrong. I > don't know how this actually happened, but working back through the > relevant tuplesort_begin_datum() caller, initialize_aggregate(), does > suggest some things. (tuplesort_begin_datum() is where datumTypeLen is > determined for the entire datum tuplesort.) > > I am once again only guessing, but I have to wonder if this is a > problem in commit b8d7f053. It seems likely that the problem begins > before tuplesort_begin_datum() is even called, which is the basis of > this suspicion. If the problem is within tuplesort, then that could > only be because get_typlenbyval() gives wrong answers, which seems > very unlikely. Not saying it's not the fault of b8d7f053 et al, but I don't quite see how - whether something is a varlena tuple or not isn't really something expression evaluation has an influence over if it doesn't happen from within its code. That's the responsibility of the calling code, not from within the datum. So I don't quite understand how you got to b8d7f053? - Andres -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs