[postgis] Server-Crash when INSERTing NULL geometries

Bernhard Herzog bh at intevation.de
Wed Feb 27 10:28:37 PST 2002


Hi,

We have severe problems with inserting large numbers of records where
the geometry is NULL. After a varying number of SQL statements, the
server crashes with the following lines in the logfile:

Server process (pid 20730) exited with status 11 at Wed Feb 27 17:57:36 2002
Terminating any active server processes...

We can reproduce it with postgresql 7.1.3 and the current CVS version of
PostGIS. 

A simple test-case we've come up with is the following.

1. Create the postgis_crash database:

createdb postgis_crash

2. create a table with a geometry column and an index in the
   postgis_crash db:

CREATE TABLE kposition (    
       kid INT 
);

SELECT AddGeometryColumn('postgis_crash', 'kposition', 'position_geom', 
			 '1', 'POINT', 2);

CREATE INDEX idx_position_geom ON kposition USING GIST(position_geom);



3. Execute lots of insert statements similar to this one

INSERT INTO kposition VALUES (50000, NULL);

All with different values for kid although that doesn't matter perhaps
(in the database where we found the problem originally, the id was a
primary key). Here's a small python program that can generate them:

for kid in range(50000, 52000):
    print "INSERT INTO kposition VALUES (%d, NULL);" % kid


Assuming we've put those queries into crash.sql, we can make the server
crash with:

psql -f crash.sql postgis_crash

Which produces an error message:

psql:crash.sql:738: pqReadData() -- backend closed the channel unexpectedly.
	This probably means the backend terminated abnormally
	before or while processing the request.
psql:crash.sql:738: connection to server was lost


The line number may vary. You might have to execute more than the 2000
statements produced by the script by default.



Other observations:

It doesn't crash if there's no index. It also doesn't crash when we
don't insert NULLs but dummy values like 
GeometryFromText('POINT(0 0)', 1)

We compiled postgresql with debugging options and found the following
assertion failure:

TRAP: Failed Assertion("!(pointer != ((void *)0)):", File: "mcxt.c", Line: 438)


   Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Sketch                                 http://sketch.sourceforge.net/
MapIt!                                               http://mapit.de/

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Tiny Wireless Camera under $80!
Order Now! FREE VCR Commander!
Click Here - Only 1 Day Left!
http://us.click.yahoo.com/nuyOHD/7.PDAA/yigFAA/PhFolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
postgis-unsubscribe at yahoogroups.com

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 





More information about the postgis-users mailing list