[postgis-tickets] [PostGIS] #2267: Server crash from analyze table

PostGIS trac at osgeo.org
Tue Apr 9 11:54:49 PDT 2013


#2267: Server crash from analyze table
-------------------------------------------+--------------------------------
 Reporter:  peters                         |       Owner:  pramsey      
     Type:  defect                         |      Status:  new          
 Priority:  blocker                        |   Milestone:  PostGIS 2.0.4
Component:  postgis                        |     Version:  2.0.x        
 Keywords:  geography point analyze crash  |  
-------------------------------------------+--------------------------------

Comment(by peters):

 I reproduced on my dev system, running 9.2.4, 2.0.3 under CENTOS-5.

 Only really special thing about this build is use of larger block size
 (./configure --with-blocksize=32 --with-wal-blocksize=32 --enable-debug).

 Rebuilt postgres and postgis for debugging, ran posted test case using
 psql client:

 Psql client output:

 analyze verbose foo;

 INFO:  analyzing "public.foo"

 NOTICE:  [geography_estimate.c:geography_analyze:1490] geography_analyze
 called

 NOTICE:  [geography_estimate.c:geography_analyze:1497]  attribute stat
 target: 500

 NOTICE:  [geography_estimate.c:geography_analyze:1503]  minrows: 150000

 INFO:  "foo": scanned 1 of 1 pages, containing 2 live rows and 0 dead
 rows; 2 rows
 in sample, 2 estimated total rows

 NOTICE:  [geography_estimate.c:compute_geography_stats:826]
 compute_geography_stats
 called

 NOTICE:  [geography_estimate.c:compute_geography_stats:932] End of 1st
 scan:

 NOTICE:  [geography_estimate.c:compute_geography_stats:934]  Sample extent
 (min,
 max): (0.940639 0.0197043 0.338738), (0.940674 0.0213461 0.338738)

 NOTICE:  [geography_estimate.c:compute_geography_stats:935]  No. of
 geometries
 sampled: 2

 NOTICE:  [geography_estimate.c:compute_geography_stats:936]  No. of non-
 null
 geometries sampled: 2

 NOTICE:  [geography_estimate.c:compute_geography_stats:947] Standard
 deviation
 filter enabled

 NOTICE:  [geography_estimate.c:compute_geography_stats:979]  standard
 deviations:

 NOTICE:  [geography_estimate.c:compute_geography_stats:980]   LOWx -
 avg:0.940656
 sd:0.000018

 NOTICE:  [geography_estimate.c:compute_geography_stats:981]   LOWy -
 avg:0.020525
 sd:0.000821

 NOTICE:  [geography_estimate.c:compute_geography_stats:982]   LOWz -
 avg:0.338738 sd:0.000000

 NOTICE:  [geography_estimate.c:compute_geography_stats:983]   HIGx -
 avg:0.940657
 sd:0.000018

 NOTICE:  [geography_estimate.c:compute_geography_stats:984]   HIGy -
 avg:0.020525
 sd:0.000821

 NOTICE:  [geography_estimate.c:compute_geography_stats:985]   HIGz -
 avg:0.338738 sd:0.000000

 NOTICE:  [geography_estimate.c:compute_geography_stats:995]  sd_extent:
 xmin, ymin, zmin: 0.940639, 0.019704, 0.338738

 NOTICE:  [geography_estimate.c:compute_geography_stats:997]  sd_extent:
 xmax, ymax, zmax: 0.940674, 0.021346, 0.338738

 NOTICE:  [geography_estimate.c:compute_geography_stats:1083]
 histogram_extent: xmin, ymin, zmin: 0.940639, 0.019704, 0.338738

 NOTICE:  [geography_estimate.c:compute_geography_stats:1085]
 histogram_extent: xmax, ymax, zmax: 0.940674, 0.021346, 0.338738

 NOTICE:  [geography_estimate.c:compute_geography_stats:1129] Number of
 dimensions in sample set: 3

 NOTICE:  [geography_estimate.c:compute_geography_stats:1247]  computed
 histogram grid size (X,Y,Z): 128 x 5863 x 0 (0 out of 80000 cells)

 NOTICE:  [geography_estimate.c:compute_geography_stats:1285] Beginning
 histogram intersection calculations

 NOTICE:  [geography_estimate.c:compute_geography_stats:1304]  feat 0 box
 is 0.940674 0.019704 0.338738, 0.940674 0.019704 0.338738

 NOTICE:  [geography_estimate.c:compute_geography_stats:1337]  feat 0
 overlaps unitsx 127-127, unitsy 0-0, unitsz -1--1

 Gdb server side:

 Program received signal SIGSEGV, Segmentation fault.

 0x00002b803a870407 in compute_geography_stats (stats=0x1321db98,
 fetchfunc=0x569d3f <std_fetch_func>, samplerows=2, totalrows=2) at
 geography_estimate.c:1367
 1367                                            geogstats->value[x + y *
 unitsx + z * unitsx * unitsy] += 1;

 (gdb) where

 #0  0x00002b803a870407 in compute_geography_stats (stats=0x1321db98,
 fetchfunc=0x569d3f <std_fetch_func>, samplerows=2, totalrows=2) at
 geography_estimate.c:1367

 #1  0x00000000005677df in do_analyze_rel (onerel=0x2b803bfbab00,
 vacstmt=0x131d51f0, acquirefunc=0x5687e2 <acquire_sample_rows>,
 relpages=1, inh=0 '\000', elevel=17) at analyze.c:525

 #2  0x0000000000566e13 in analyze_rel (relid=57344, vacstmt=0x131d51f0,
 bstrategy=0x1321b300) at analyze.c:265

 #3  0x00000000005d2c86 in vacuum (vacstmt=0x131d51f0, relid=0, do_toast=1
 '\001', bstrategy=0x1321b300, for_wraparound=0 '\000', isTopLevel=1
 '\001') at vacuum.c:247

 #4  0x000000000070004e in standard_ProcessUtility (parsetree=0x131d51f0,
 queryString=0x131d47c0 "analyze verbose foo;", params=0x0, isTopLevel=1
 '\001', dest=0x131d5530,
     completionTag=0x7fff713d3370 "") at utility.c:1027

 #5  0x00002b80194c917c in pgss_ProcessUtility () from
 /usr/local/pgsql/lib/pg_stat_statements.so

 #6  0x00000000006fef11 in ProcessUtility (parsetree=0x131d51f0,
 queryString=0x131d47c0 "analyze verbose foo;", params=0x0, isTopLevel=1
 '\001', dest=0x131d5530, completionTag=0x7fff713d3370 "")
     at utility.c:332

 #7  0x00000000006fdff8 in PortalRunUtility (portal=0x13146360,
 utilityStmt=0x131d51f0, isTopLevel=1 '\001', dest=0x131d5530,
 completionTag=0x7fff713d3370 "") at pquery.c:1185

 #8  0x00000000006fe18f in PortalRunMulti (portal=0x13146360, isTopLevel=1
 '\001', dest=0x131d5530, altdest=0x131d5530, completionTag=0x7fff713d3370
 "") at pquery.c:1316

 #9  0x00000000006fd7ff in PortalRun (portal=0x13146360,
 count=9223372036854775807, isTopLevel=1 '\001', dest=0x131d5530,
 altdest=0x131d5530, completionTag=0x7fff713d3370 "") at pquery.c:814

 #10 0x00000000006f7d16 in exec_simple_query (query_string=0x131d47c0
 "analyze verbose foo;") at postgres.c:1046

 #11 0x00000000006fbc3a in PostgresMain (argc=1, argv=0x131266b0,
 dbname=0x13126698 "gsw", username=0x13126680 "gsw") at postgres.c:3959

 #12 0x00000000006a9cfb in BackendRun (port=0x1314b450) at
 postmaster.c:3614

 #13 0x00000000006a9412 in BackendStartup (port=0x1314b450) at
 postmaster.c:3304

 #14 0x00000000006a632a in ServerLoop () at postmaster.c:1367

 #15 0x00000000006a5cb8 in PostmasterMain (argc=1, argv=0x131247e0) at
 postmaster.c:1127

 #16 0x000000000061d98c in main (argc=1, argv=0x131247e0) at main.c:199

 So problem appears to be in postgis compute_geography_stats ().

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2267#comment:4>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list