pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #11902: PostgreSQL 9.5 crashes on alter table in function
8+ messages / 6 participants
[nested] [flat]

* BUG #11902: PostgreSQL 9.5 crashes on alter table in function
@ 2014-11-06 18:01 lr@pcorp.us
  2014-11-06 18:06 ` Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function Andres Freund <andres@2ndquadrant.com>
  0 siblings, 1 reply; 8+ messages in thread

From: lr@pcorp.us @ 2014-11-06 18:01 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      11902
Logged by:          Regina Obe
Email address:      lr@pcorp.us
PostgreSQL version: Unsupported/Unknown
Operating system:   Debian and Windows MingW-w64 (both 64 and 32-bit)
Description:        

I wanted to pick 9.5 in PostgreSQL version, but that is not listed.  Anyway
for the past couple of weeks regressing against latest snapshots of 9.5 has
been crashing our PostGIS topology tests.

Related ticket here:
http://trac.osgeo.org/postgis/ticket/2982

I was able to crash without PostGIS help with this script:

CREATE OR REPLACE FUNCTION crash_test(table_name varchar, column_name
varchar)
  RETURNS bigint AS
$$
DECLARE
 var_result bigint;
BEGIN
       EXECUTE 'ALTER TABLE ' || quote_ident(table_name) || ' ADD COLUMN '
|| quote_ident(column_name) || ' text;';
       var_result = (random()*100000)::bigint;
       RETURN var_result;
END
$$
  LANGUAGE plpgsql VOLATILE
  COST 100;

DROP TABLE IF EXISTS test_1;
CREATE TABLE test_1(id serial primary key);
DROP TABLE IF EXISTS test_crash;
CREATE TEMP TABLE test_crash AS 
SELECT 1 As id, crash_test('test_1', 'lyr1') As layer;

INSERT INTO test_crash(id, layer)
SELECT id + 1, crash_test('test_1', 'lyr' || (id + 1)::text)
FROM test_crash
WHERE id = 1;


Our buildbot runs Debian 64-bit, and I also tested this on my Mingw64
Windows 7 both (64-bit and 32-bit with same issue)

Issue seems to be around here according to gdb trace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 5568.0x15c4]
0x000000000054fbc9 in AfterTriggerPendingOnRel (relid=17984) at
trigger.c:4781
4781                    for_each_event_chunk(event, chunk,
afterTriggers.query_stack[depth])
(gdb) bt
#0  0x000000000054fbc9 in AfterTriggerPendingOnRel (relid=17984) at
trigger.c:4781
#1  0x000000000053e05c in CheckTableNotInUse (rel=0xe650dc0, stmt=0x8ab69a
<__func__.77621+8091> "ALTER TABLE") at tablecmds.c:2652
#2  0x0000000000545315 in AlterTable (relid=relid@entry=17984,
lockmode=lockmode@entry=8, stmt=0xe32b580) at tablecmds.c:2724



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function
  2014-11-06 18:01 BUG #11902: PostgreSQL 9.5 crashes on alter table in function lr@pcorp.us
@ 2014-11-06 18:06 ` Andres Freund <andres@2ndquadrant.com>
  2014-11-06 18:25   ` Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function Paragon Corporation <lr@pcorp.us>
  0 siblings, 1 reply; 8+ messages in thread

From: Andres Freund @ 2014-11-06 18:06 UTC (permalink / raw)
  To: lr@pcorp.us; Robert Haas <robertmhaas@gmail.com>; +Cc: pgsql-bugs

Hi Regina,

> I wanted to pick 9.5 in PostgreSQL version, but that is not listed.  Anyway
> for the past couple of weeks regressing against latest snapshots of 9.5 has
> been crashing our PostGIS topology tests.

> I was able to crash without PostGIS help with this script:

Thanks for the report. Very useful. Can you tell us the exact git
checkout this is based upon?

This is very likely caused by 2781b4b. There was one fix shortly
afterwards 85bb81de.

Greetings,

Andres Freund


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function
  2014-11-06 18:01 BUG #11902: PostgreSQL 9.5 crashes on alter table in function lr@pcorp.us
  2014-11-06 18:06 ` Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function Andres Freund <andres@2ndquadrant.com>
@ 2014-11-06 18:25   ` Paragon Corporation <lr@pcorp.us>
  2014-11-06 21:15     ` Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 8+ messages in thread

From: Paragon Corporation @ 2014-11-06 18:25 UTC (permalink / raw)
  To: 'Andres Freund' <andres@2ndquadrant.com>; 'Robert Haas' <robertmhaas@gmail.com>; +Cc: pgsql-bugs

Note sure.  It was built from snapshot here
http://www.postgresql.org/ftp/snapshot/dev/ and as far as I could reckon the
issue started happening about 12-15 days ago.

The last one I built to test with from there I think was dated around
11/4/2014.

I can pull from latest git and then run the tests again if you think the
issue is fixed.

Thanks,
Regina

-----Original Message-----
From: Andres Freund [mailto:andres@2ndquadrant.com] 
Sent: Thursday, November 06, 2014 1:06 PM
To: lr@pcorp.us; Robert Haas
Cc: pgsql-bugs@postgresql.org
Subject: Re: [BUGS] BUG #11902: PostgreSQL 9.5 crashes on alter table in
function

Hi Regina,

> I wanted to pick 9.5 in PostgreSQL version, but that is not listed.  
> Anyway for the past couple of weeks regressing against latest 
> snapshots of 9.5 has been crashing our PostGIS topology tests.

> I was able to crash without PostGIS help with this script:

Thanks for the report. Very useful. Can you tell us the exact git checkout
this is based upon?

This is very likely caused by 2781b4b. There was one fix shortly afterwards
85bb81de.

Greetings,

Andres Freund




-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function
  2014-11-06 18:01 BUG #11902: PostgreSQL 9.5 crashes on alter table in function lr@pcorp.us
  2014-11-06 18:06 ` Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function Andres Freund <andres@2ndquadrant.com>
  2014-11-06 18:25   ` Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function Paragon Corporation <lr@pcorp.us>
@ 2014-11-06 21:15     ` Tom Lane <tgl@sss.pgh.pa.us>
  2014-11-06 21:24       ` Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function 'Andres Freund' <andres@2ndquadrant.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Tom Lane @ 2014-11-06 21:15 UTC (permalink / raw)
  To: Paragon Corporation <lr@pcorp.us>; +Cc: 'Andres Freund' <andres@2ndquadrant.com>; 'Robert Haas' <robertmhaas@gmail.com>; pgsql-bugs

"Paragon Corporation" <lr@pcorp.us> writes:
> I can pull from latest git and then run the tests again if you think the
> issue is fixed.

No, the given test case crashes HEAD just fine.  Robert seems to have
changed the invariants around the trigger query stack in some inconsistent
fashion.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function
  2014-11-06 18:01 BUG #11902: PostgreSQL 9.5 crashes on alter table in function lr@pcorp.us
  2014-11-06 18:06 ` Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function Andres Freund <andres@2ndquadrant.com>
  2014-11-06 18:25   ` Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function Paragon Corporation <lr@pcorp.us>
  2014-11-06 21:15     ` Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function Tom Lane <tgl@sss.pgh.pa.us>
@ 2014-11-06 21:24       ` 'Andres Freund' <andres@2ndquadrant.com>
  2014-11-06 22:07         ` Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 8+ messages in thread

From: Andres Freund @ 2014-11-06 21:24 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Paragon Corporation <lr@pcorp.us>; Robert Haas <robertmhaas@gmail.com>; pgsql-bugs

On 2014-11-06 16:15:15 -0500, Tom Lane wrote:
> "Paragon Corporation" <lr@pcorp.us> writes:
> > I can pull from latest git and then run the tests again if you think the
> > issue is fixed.
> 
> No, the given test case crashes HEAD just fine.  Robert seems to have
> changed the invariants around the trigger query stack in some inconsistent
> fashion.

I think it's just a missing

if (depth < afterTriggers.maxquerydepth)
   continue;
or similar in AfterTriggerPendingOnRel, inside the second loop.

Alternatively we could make the for something like
depth = 0; depth <= Min(afterTriggers.query_depth, afterTriggers.query_depth - 1)
but that doesn't seem prettier.

Robert?

Greetings,

Andres Freund

-- 
 Andres Freund	                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function
  2014-11-06 18:01 BUG #11902: PostgreSQL 9.5 crashes on alter table in function lr@pcorp.us
  2014-11-06 18:06 ` Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function Andres Freund <andres@2ndquadrant.com>
  2014-11-06 18:25   ` Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function Paragon Corporation <lr@pcorp.us>
  2014-11-06 21:15     ` Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function Tom Lane <tgl@sss.pgh.pa.us>
  2014-11-06 21:24       ` Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function 'Andres Freund' <andres@2ndquadrant.com>
@ 2014-11-06 22:07         ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 8+ messages in thread

From: Tom Lane @ 2014-11-06 22:07 UTC (permalink / raw)
  To: 'Andres Freund' <andres@2ndquadrant.com>; +Cc: Paragon Corporation <lr@pcorp.us>; 'Robert Haas' <robertmhaas@gmail.com>; pgsql-bugs

"'Andres Freund'" <andres@2ndquadrant.com> writes:
> On 2014-11-06 16:15:15 -0500, Tom Lane wrote:
>> No, the given test case crashes HEAD just fine.  Robert seems to have
>> changed the invariants around the trigger query stack in some inconsistent
>> fashion.

> I think it's just a missing
> if (depth < afterTriggers.maxquerydepth)
>    continue;
> or similar in AfterTriggerPendingOnRel, inside the second loop.

No such test was required before.  If one's needed now, then I'd wonder
what other places have new bugs of the same ilk.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function seems to be fixed
@ 2014-11-26 00:47 Paragon Corporation <lr@pcorp.us>
  2014-11-26 02:15 ` Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function seems to be fixed David G Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Paragon Corporation @ 2014-11-26 00:47 UTC (permalink / raw)
  To: pgsql-bugs

I wasn't sure if you guys knew or not, but this bug I complained about 


http://www.postgresql.org/message-id/3367.1415311625@sss.pgh.pa.us


That would crash with this piece of code seems to have gone

CREATE OR REPLACE FUNCTION crash_test(table_name varchar, column_name
varchar)
  RETURNS bigint AS
$$
DECLARE
 var_result bigint;
BEGIN
       EXECUTE 'ALTER TABLE ' || quote_ident(table_name) || ' ADD COLUMN '
|| quote_ident(column_name) || ' text;';
       var_result = (random()*100000)::bigint;
       RETURN var_result;
END
$$
  LANGUAGE plpgsql VOLATILE
  COST 100;

DROP TABLE IF EXISTS test_1;
CREATE TABLE test_1(id serial primary key);
DROP TABLE IF EXISTS test_crash;
CREATE TEMP TABLE test_crash AS 
SELECT 1 As id, crash_test('test_1', 'lyr1') As layer;

INSERT INTO test_crash(id, layer)
SELECT id + 1, crash_test('test_1', 'lyr' || (id + 1)::text)
FROM test_crash
WHERE id = 1;


-- I noticed it when our 9.5 weekly PostGIS bot tests started passing.

I'm guessing its been fixed for a week or so.


Thanks,
Regina




-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function seems to be fixed
  2014-11-26 00:47 Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function seems to be fixed Paragon Corporation <lr@pcorp.us>
@ 2014-11-26 02:15 ` David G Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 8+ messages in thread

From: David G Johnston @ 2014-11-26 02:15 UTC (permalink / raw)
  To: pgsql-bugs

Paragon Corporation wrote
> I wasn't sure if you guys knew or not, but this bug I complained about 
> 
> 
> http://www.postgresql.org/message-id/3367.1415311625@sss.pgh.pa.us
> 
> 
> That would crash with this piece of code seems to have gone
> 
> -- I noticed it when our 9.5 weekly PostGIS bot tests started passing.
> 
> I'm guessing its been fixed for a week or so.

It appears Robert addressed this in c8df9477

http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=c8df9477f8ce48b202de989984f90dd78e...

I am not sure why neither the bug report nor the commit reference the
other...

I read that commit as Robert addressing Tom's concern by stating that indeed
the behavior of the triggers changed and just the one specific site was
overlooked.

David J.




--
View this message in context: http://postgresql.nabble.com/Re-BUG-11902-PostgreSQL-9-5-crashes-on-alter-table-in-function-seems-to...
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2014-11-26 02:15 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-11-06 18:01 BUG #11902: PostgreSQL 9.5 crashes on alter table in function lr@pcorp.us
2014-11-06 18:06 ` Andres Freund <andres@2ndquadrant.com>
2014-11-06 18:25   ` Paragon Corporation <lr@pcorp.us>
2014-11-06 21:15     ` Tom Lane <tgl@sss.pgh.pa.us>
2014-11-06 21:24       ` 'Andres Freund' <andres@2ndquadrant.com>
2014-11-06 22:07         ` Tom Lane <tgl@sss.pgh.pa.us>
2014-11-26 00:47 Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function seems to be fixed Paragon Corporation <lr@pcorp.us>
2014-11-26 02:15 ` Re: BUG #11902: PostgreSQL 9.5 crashes on alter table in function seems to be fixed David G Johnston <david.g.johnston@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox