[postgis-users] postgres server crash caused by postgis collect() function

Christian Sengstock csengstock at gmail.com
Fri Jan 20 04:51:27 PST 2006


Hi,
i found the cause of the postgres crash due to the excecution of the
collect() function. Following a short description.

2006/1/19, Michael Fuhr <mike at fuhr.org>:
>
> On Thu, Jan 19, 2006 at 05:01:14PM +0100, Christian Sengstock wrote:
> > i've got a problem with a signal 11 termination of my postgres database.
> the
> > error occurs then querying my geo tables with the collect() function of
> > postgis. anyone knows what the signal 11 error means?




On most systems signal 11 is a segmentation fault; it generally
> means that a program has attempted to use memory it's not allowed
> to use.  That usually indicates a programming bug.
>
> > Postgis_version: 1.0
>
> 1.0.what?  What does "SELECT postgis_full_version()" show?  Recent
> versions have fixed several crash-causing bugs, so if you're not
> running the latest code (1.0.6 or 1.1.0) then try upgrading.  If
> you still get crashes then please post a simple but complete test
> case so others can try it.


My postgis_full_version() is POSTGIS="1.0.2" GEOS="2.1.1" PROJ="Rel. 4.4.9,
29 Oct 2004" USE_STATS DBPROC="0.3.0" RELPROC="0.3.0". Maybe this behaviour
does not occur in the following versions. Could not test that.

The crash occurs if the first record of a geometry set, which is the
argument of the collect() function is NULL, and there's a not NULL record
following. No problem occurs if the argument is just a set of NULL values.

Hence, if you have the following tables (see below) the query ...

# SELECT collect(geom) FROM rs_1;

will work, because there's no NULL record at the beginning.

# SELECT collect(geom) FROM rs_2;

will not work, because the first record is a null value.


-- Create rs_1 with geometry in every record
CREATE TABLE rs_1 (id serial PRIMARY KEY, type int8);
SELECT AddGeometryColumn('','rs_1','geom','-1','MULTILINESTRING',2);
INSERT INTO rs_1 (type, geom) VALUES (1, GeomFromEWKT('
SRID=-1;MULTILINESTRING((3474442.25 5475262,3474440.25 5475299,3474436.75
5475333.5,3474433.25 5475345)) ') );
INSERT INTO rs_1 (type, geom) VALUES (1, GeomFromEWKT('
SRID=-1;MULTILINESTRING((3474350 5475010.5,3474375.25 5475065,3474407.5
5475140.5,3474420.77060961 5475162.09117775)) ') );
INSERT INTO rs_1 (type, geom) VALUES (1, GeomFromEWKT('
SRID=-1;MULTILINESTRING((3474416.5 5475518.5,3474415.25 5475521,
3474379.93050191 5475573.4185714)) ') );
INSERT INTO rs_1 (type, geom) VALUES (1, GeomFromEWKT('
SRID=-1;MULTILINESTRING((3474433.25 5475345,3474429 5475422.5,3474428.25
5475474.5,3474416.5 5475518.5)) ') );

-- Create rs_2 with NULL geometry in first record
CREATE TABLE rs_2 (id serial PRIMARY KEY, type int8);
SELECT AddGeometryColumn('','rs_2','geom','-1','MULTILINESTRING',2);
INSERT INTO rs_2 (type, geom) VALUES (1, NULL );
INSERT INTO rs_2 (type, geom) VALUES (1, GeomFromEWKT('
SRID=-1;MULTILINESTRING((3474350 5475010.5,3474375.25 5475065,3474407.5
5475140.5,3474420.77060961 5475162.09117775)) ') );
INSERT INTO rs_2 (type, geom) VALUES (1, GeomFromEWKT('
SRID=-1;MULTILINESTRING((3474416.5 5475518.5,3474415.25 5475521,
3474379.93050191 5475573.4185714)) ') );
INSERT INTO rs_2 (type, geom) VALUES (1, GeomFromEWKT('
SRID=-1;MULTILINESTRING((3474433.25 5475345,3474429 5475422.5,3474428.25
5475474.5,3474416.5 5475518.5)) ') );


I will try this on a newer postgis version now. maybe this will not occur
anymore.

thanx,
chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20060120/1fce4e23/attachment.html>


More information about the postgis-users mailing list