BUG #14283: PostgreSQL 9.6 head crashing PostGIS bot

From: lr(at)pcorp(dot)us
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #14283: PostgreSQL 9.6 head crashing PostGIS bot
Date: 2016-08-07 05:18:54
Message-ID: 20160807051854.1427.32414@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14283
Logged by: Regina Obe
Email address: lr(at)pcorp(dot)us
PostgreSQL version: 9.6beta3
Operating system: Mingw64 Windows 7 and Debian
Description:

Note this is after 9.6beta3 release, but I had to select a version.

Since around 8/3/2016 our Debian PostGIS build bot has been crashing during
test to install PostGIS (using non-extension), what's interesting is that
when installed via

CREATE EXTENSION postgis;

it does not crash. I was able to replacate the issue under windows as well
mingw64, and traced it to the part of the install script that does this:

CREATE OR REPLACE VIEW geography_columns AS
SELECT
current_database() AS f_table_catalog,
n.nspname AS f_table_schema,
c.relname AS f_table_name,
a.attname AS f_geography_column,
postgis_typmod_dims(a.atttypmod) AS coord_dimension,
postgis_typmod_srid(a.atttypmod) AS srid,
postgis_typmod_type(a.atttypmod) AS type
FROM
pg_class c,
pg_attribute a,
pg_type t,
pg_namespace n
WHERE t.typname = 'geography'
AND a.attisdropped = false
AND a.atttypid = t.oid
AND a.attrelid = c.oid
AND c.relnamespace = n.oid
AND NOT pg_is_other_temp_schema(c.relnamespace)
AND has_table_privilege( c.oid, 'SELECT'::text );

The backtrace of the error is showing:

Reading symbols from
C:\ming64gcc48\projects\postgresql\rel\pg9.6w64gcc48\bin\postgres.exe...done.
0x00000000777cae11 in ntdll!DbgBreakPoint ()
from C:\Windows\SYSTEM32\ntdll.dll
(gdb) cont
Continuing.
[Thread 27196.0x7f9c exited with code 0]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 27196.0x7198]
GetOldestSnapshot () at snapmgr.c:422
422 return OldestActiveSnapshot->as_snap;
(gdb) bt
#0 GetOldestSnapshot () at snapmgr.c:422
#1 0x000000000044efdd in init_toast_snapshot (toast_snapshot=0x299e9b0)
at tuptoaster.c:2314
#2 0x000000000044f123 in toast_fetch_datum (attr=<optimized out>)
at tuptoaster.c:1869
#3 0x00000000004508c6 in heap_tuple_untoast_attr (attr=0x59c04ca)
at tuptoaster.c:179
#4 0x00000000007bc9da in pg_detoast_datum_packed (datum=<optimized out>)
at fmgr.c:2266
#5 0x0000000000790620 in text_to_cstring (t=0x59c04ca) at varlena.c:186
#6 0x00000000007a3a95 in RelationBuildRuleLock (
relation=relation(at)entry=0xe7dcd48) at relcache.c:732
#7 0x00000000007a621a in RelationBuildDesc (
targetRelId=targetRelId(at)entry=58124, insertIt=insertIt(at)entry=0 '\000')
at relcache.c:1035
#8 0x00000000007a6625 in RelationClearRelation (
relation=relation(at)entry=0xe7dc4d0, rebuild=rebuild(at)entry=1 '\001')
at relcache.c:2218
#9 0x00000000007a70b8 in RelationFlushRelation (relation=0xe7dc4d0)
at relcache.c:2330
#10 RelationCacheInvalidateEntry (relationId=58124) at relcache.c:2392
#11 0x00000000007a075e in LocalExecuteInvalidationMessage (
msg=msg(at)entry=0xe707990) at inval.c:568
#12 0x00000000007a0876 in ProcessInvalidationMessages (hdr=0x4e13088,
func=0x7a0650 <LocalExecuteInvalidationMessage>) at inval.c:444
#13 0x00000000007a08a9 in CommandEndInvalidationMessages () at
inval.c:1056
#14 0x0000000000489486 in AtCCI_LocalCache () at xact.c:1377
#15 CommandCounterIncrement () at xact.c:956
#16 0x00000000006b0d22 in exec_simple_query (
query_string=0x100000000000000 <error: Cannot access memory at address
0x100000000000000>) at postgres.c:1133
#17 PostgresMain (argc=<optimized out>, argv=argv(at)entry=0x2495c8,
dbname=0x18001700160015 <error: Cannot access memory at address
0x18001700160015>, username=<optimized out>) at postgres.c:4074
#18 0x000000000064794d in BackendRun (port=0x299f400) at postmaster.c:4262
#19 SubPostmasterMain (argc=argc(at)entry=3, argv=argv(at)entry=0x2b7e80)
at postmaster.c:4752
#20 0x0000000000803ac8 in main (argc=3, argv=0x2b7e80) at main.c:205

This is also logged in PostGIS bug tracker:
https://trac.osgeo.org/postgis/ticket/3609

Given the timing of when the error started, I am highly suspecting this
commit:

Prevent "snapshot too old" from trying to return pruned TOAST tuples.
(Commit 3e2f3c2e423b3ae906668c186bac79522b8e3e29 by rhaas)

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=3e2f3c2e423b3ae906668c186bac79522b8e3e29

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2016-08-07 05:24:53 Re: BUG #14283: PostgreSQL 9.6 head crashing PostGIS bot
Previous Message anbazhagan.m1 2016-08-07 03:15:43 BUG #14282: Issue with pg_restore