Ticket #1504 (closed defect: fixed)

Opened 16 months ago

Last modified 16 months ago

Segfault running ST_EstimatedExtent()

Reported by: brushtyler Owned by: pramsey
Priority: blocker Milestone: PostGIS 2.0.0
Component: postgis Version: trunk
Keywords: Cc:

Description

2012-01-27 16:12:40 CET LOG: statement: SELECT st_estimated_extent('city_data','face','mbr') AS extent; 2012-01-27 16:12:40 CET LOG: server process (PID 27986) was terminated by signal 11: Segmentation fault

where city_data is the sample dataset for topology.

Change History

  Changed 16 months ago by strk

can you reproduce from the terminal ?

  Changed 16 months ago by brushtyler

yes, the server crashes even running that query from psql.

Anyway the original query was:

test=> SELECT st_xmin(extent), st_ymin(extent), st_xmax(extent), st_ymax(extent) FROM (SELECT st_estimated_extent('city_data','face','mbr') AS extent) AS subquery;
The connection to the server was lost. Attempting reset: Failed.

instead running the query above I get:

test=> SELECT st_estimated_extent('city_data','face','mbr') AS extent;
The connection to the server was lost. Attempting reset: Succeeded.

  Changed 16 months ago by brushtyler

I also get the same problem with other geometry tables, but I'm unable to find a common pattern.

  Changed 16 months ago by brushtyler

I forgot to say that I'm on Ubuntu 11.04, PostgreSQL 8.4.10, PostGis? trunk r8942.

  Changed 16 months ago by strk

select count(*) from city_data.face.mbr; -- please ?

  Changed 16 months ago by pramsey

If you dump/restore the table, does the problem recur? (Because if so, dump the table so we can try it on our machines.)

  Changed 16 months ago by brushtyler

Unable to restore the table...

psql:test/dump_test_1504.sql:7902: ERROR: SRID value 2097151 > SRID_MAXIMUM (999999) LINE 3: mbr public.geometry(Polygon,2097151)

I'm trying with the other tables I get the same error on.

  Changed 16 months ago by brushtyler

Same problem also with other tables:

psql:test/dump_test_1504.sql:34: ERROR: SRID value 2097151 > SRID_MAXIMUM (999999) LINE 12: geom_event geometry(LineStringM,2097151)

  Changed 16 months ago by pramsey

how did you get it in, in the first place then?

  Changed 16 months ago by brushtyler

Before updating PostGIS to the latest trunk that query worked fine. Those tables was created before updating, so something is changed (maybe the MAX_SRID?) but I'm unable to say what revision I had had before.

  Changed 16 months ago by pramsey

  • status changed from new to closed
  • resolution set to invalid

You can't just drop a 2.0 install on top of a 1.5 database, you *need* to dump and restore.

  Changed 16 months ago by strk

You are restoring it _wrong_ , use postgis_restore.pl, see instructions in the postgis manual, under HARD UPGRADE.

  Changed 16 months ago by strk

  • status changed from closed to reopened
  • resolution invalid deleted

Wait a second, even if he restores the right way he would still have troubles restoring the _data_, wouldn't him ?

His only bet would be changing the SRIDs, can't not even drop the check from anywhere but touching the code. We should deal with this somehow.

  Changed 16 months ago by pramsey

  • status changed from reopened to closed
  • resolution set to invalid

That's a different ticket, please open it, but leave this one closed! :)

follow-up: ↓ 16   Changed 16 months ago by brushtyler

  • status changed from closed to reopened
  • resolution invalid deleted

I've found a way to reproduce it:

test=> CREATE TABLE "test_1504" (id int PRIMARY KEY, geom geometry(LineString,3003));
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "test_1504_pkey" for table "test_1504"
CREATE TABLE
test=> INSERT INTO "test_1504" (id, geom) VALUES (0, NULL);
INSERT 0 1
test=> ALTER TABLE "test_1504" ALTER COLUMN geom TYPE geometry(LineString, -1);
NOTICE:  SRID value -1 converted to the officially unknown SRID value 0
NOTICE:  SRID value -1 converted to the officially unknown SRID value 0
ALTER TABLE
test=> select st_estimated_extent('test_1504', 'geom');
The connection to the server was lost. Attempting reset: Failed.

NB: I tried to add with a geometry not NULL, but I got the same result (segfault).

After reconnecting and querying the table to get srid it returns a strange result:

test=> select st_srid(geom) from "test_1504";
 st_srid 
---------
        
(1 row)

I think that pg_dump now returns that strange (and maybe random) srid > MAX_SRID.

in reply to: ↑ 15   Changed 16 months ago by brushtyler

Replying to brushtyler:

After reconnecting and querying the table to get srid it returns a strange result: {{{ test=> select st_srid(geom) from "test_1504"; st_srid --------- (1 row) }}}

Obviously the srid is empty because the geometry is NULL...

  Changed 16 months ago by pramsey

That's a winner, segfaults on me. Having a look.

  Changed 16 months ago by pramsey

  • status changed from reopened to closed
  • resolution set to fixed

Being a bit more careful of NULL entries in the statistics table gets rid of the segfault. r8950

Note: See TracTickets for help on using tickets.