Re: PostgreSQL crashes with SIGSEGV

From: Andreas Seltenreich <andreas(dot)seltenreich(at)credativ(dot)de>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Bernd Helmle <mailings(at)oopsware(dot)de>, Peter Geoghegan <pg(at)bowt(dot)ie>, PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: PostgreSQL crashes with SIGSEGV
Date: 2017-12-14 18:47:08
Message-ID: 87po7hm9jn.fsf@credativ.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Michael Paquier writes:

> Not sure if you can provide this information, but what does the plan
> of the query look like?

We did some more reducing work on the original query and data. The
following testcase reproduces the double free reported by valgrind for
me when run against a vanilla REL9_6_STABLE build.

regards,
Andreas

--8<---------------cut here---------------start------------->8---
drop table if exists bug;
create table bug (n text, v text, b text, t text);
insert into bug
select i%9, i%9, i%16 ,i%4096 from generate_series(1,100000) g(i);
analyze bug;

explain select * from (
select thecube.nv
from ( select
(n || ' ') || coalesce(v, '') as nv
from bug
group by ((n || ' ') || coalesce(v, '')) ,cube(b, t)
) thecube
where nv = '8 8'
) sub limit 7000;
--8<---------------cut here---------------end--------------->8---

QUERY PLAN
---------------------------------------------------------------------------------------------------
Limit (cost=13422.32..15747.28 rows=7000 width=32)
-> Subquery Scan on thecube (cost=13422.32..27622.49 rows=42754 width=32)
-> GroupAggregate (cost=13422.32..27194.95 rows=42754 width=38)
Group Key: (((bug.n || ' '::text) || COALESCE(bug.v, ''::text))), bug.b, bug.t
Group Key: (((bug.n || ' '::text) || COALESCE(bug.v, ''::text))), bug.b
Group Key: (((bug.n || ' '::text) || COALESCE(bug.v, ''::text)))
Sort Key: (((bug.n || ' '::text) || COALESCE(bug.v, ''::text))), bug.t
Group Key: (((bug.n || ' '::text) || COALESCE(bug.v, ''::text))), bug.t
Filter: ((((bug.n || ' '::text) || COALESCE(bug.v, ''::text))) = '8 8'::text)
-> Sort (cost=13422.32..13672.32 rows=100000 width=42)
Sort Key: (((bug.n || ' '::text) || COALESCE(bug.v, ''::text))), bug.b, bug.t
-> Seq Scan on bug (cost=0.00..2041.00 rows=100000 width=42)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2017-12-14 18:52:31 Re: [HACKERS] Assertion failure when the non-exclusive pg_stop_backup aborted.
Previous Message Pavel Stehule 2017-12-14 17:56:10 Re: procedures and plpgsql PERFORM

Browse pgsql-bugs by date

  From Date Subject
Next Message meadow117 2017-12-14 18:58:34 BUG #14976: Connect to server
Previous Message thomas.berger 2017-12-14 18:05:21 BUG #14975: [pgrpms] make build10 for postgresql fails