Segmentation fault - mapserver - postgis

Bengt Nilsson bengt.nilsson at COMBITECH.SE
Thu Sep 13 08:25:14 EDT 2007


Hi,

I'm trying to run mapserver as a static fastcgi (WMS)application but gets 
Segmenttaion fault every second time I request a map from the server. After 
that, the fastcgi server is restarted and works for one request again, and so 
on..

My configuration is Apache 2.2.6, mod_fastcgi 2.4.2, mapserver 4.10.0, 
postgis 1.2.1, postgresql 8.1.4

For debug purposes I have stripped my mapfile to just contain a single layer.

The postgresql serverlog for the first request is:

LOG:  00000: statement: select substring(version() from 12 for (position('on' 
in version()) - 13))
LOCATION:  log_after_parse, postgres.c:605
LOG:  00000: statement: select attname from pg_attribute, pg_constraint, 
pg_class where pg_constraint.conrelid = pg_class.oid and pg_class.oid = 
pg_attribute.attrelid and pg_constraint.contype = 'p' and pg_constraint.conkey
[1] = pg_attribute.attnum and pg_class.relname = 'hamnar' and 
pg_table_is_visible(pg_class.oid) and pg_constraint.conkey[2] is null
LOCATION:  log_after_parse, postgres.c:605
LOG:  00000: statement: BEGIN
LOCATION:  log_after_parse, postgres.c:605
LOG:  00000: statement: DECLARE mycursor BINARY CURSOR FOR 
SELECT "hamn"::text,asbinary(force_collection(force_2d
(the_geom)),'NDR'),gid::text from hamnar WHERE the_geom && setSRID('BOX3D
(12.3070307010819 55.6344639852787,13.7573413069622 
56.2846738509944)'::BOX3D, find_srid('','hamnar','the_geom') )
LOCATION:  log_after_parse, postgres.c:605
LOG:  00000: statement: FETCH ALL in mycursor
LOCATION:  log_after_parse, postgres.c:605
LOG:  00000: statement: CLOSE mycursor
LOCATION:  log_after_parse, postgres.c:605

------------ and for the second, failing, request
LOG:  00000: statement: select substring(version() from 12 for (position('on' 
in version()) - 13))
LOCATION:  log_after_parse, postgres.c:605
LOG:  00000: statement: select attname from pg_attribute, pg_constraint, 
pg_class where pg_constraint.conrelid = pg_class.oid and pg_class.oid = 
pg_attribute.attrelid and pg_constraint.contype = 'p' and pg_constraint.conkey
[1] = pg_attribute.attnum and pg_class.relname = 'hamnar' and 
pg_table_is_visible(pg_class.oid) and pg_constraint.conkey[2] is null
LOCATION:  log_after_parse, postgres.c:605
LOG:  00000: statement: BEGIN
LOCATION:  log_after_parse, postgres.c:605
WARNING:  25001: there is already a transaction in progress
LOCATION:  BeginTransactionBlock, xact.c:2711
LOG:  08P01: unexpected EOF on client connection
LOCATION:  SocketBackend, postgres.c:295



The Apache error log, for the failing request, says:
[Thu Sep 13 10:06:47 2007] [error] [client 10.3.226.74] FastCGI: 
server "/srv/www/fcgi-bin/sjb-wms2" stderr: msConnPoolRequest
(Hamnar,user=postgres password=xxxxxx dbname=yyyy host=localhost) -> got 
0x81c4568
[Thu Sep 13 10:06:47 2007] [error] [client 10.3.226.74] FastCGI: 
server "/srv/www/fcgi-bin/sjb-wms2" stderr: msPOSTGISLayerFreeItemInfo 
called
[Thu Sep 13 10:06:47 2007] [error] [client 10.3.226.74] FastCGI: 
server "/srv/www/fcgi-bin/sjb-wms2" stderr: msPOSTGISLayerInitItemInfo 
called
[Thu Sep 13 10:06:47 2007] [error] [client 10.3.226.74] FastCGI: 
server "/srv/www/fcgi-bin/sjb-wms2" stderr: msPOSTGISLayerWhichShapes 
called
[Thu Sep 13 10:06:47 2007] [error] [client 10.3.226.74] FastCGI: 
server "/srv/www/fcgi-bin/sjb-wms2" stderr: 
msPOSTGISLayerRetrievePGVersion(): query = select substring(version() from 
12 for (position('on' in version()) - 13))
[Thu Sep 13 10:06:47 2007] [error] [client 10.3.226.74] FastCGI: 
server "/srv/www/fcgi-bin/sjb-wms2" stderr: 
msPOSTGISLayerRetrievePGVersion: Version String: 8.1.4
[Thu Sep 13 10:06:47 2007] [error] [client 10.3.226.74] FastCGI: incomplete 
headers (0 bytes) received from server "/srv/www/fcgi-bin/sjb-wms2"
[Thu Sep 13 10:06:47 2007] [warn] FastCGI: server "/srv/www/fcgi-bin/sjb-
wms2" (pid 7817) terminated due to uncaught signal '11' (Segmentation fault)
[Thu Sep 13 10:06:47 2007] [warn] FastCGI: server "/srv/www/fcgi-bin/sjb-
wms2" restarted (pid 7922)
[Thu Sep 13 10:06:47 2007] [error] [client 10.3.226.74] FastCGI: 
server "/srv/www/fcgi-bin/sjb-wms2" stderr: 
msPOSTGISLayerRetrievePGVersion(POSTGISLayerOpen called datastatement: 
the_geom from hamnar
~

The mapfile for the actual layer is like this

LAYER
  NAME Hamnar
  METADATA
    wms_title "Hamnar"   ##required
    wms_srs "EPSG:2400 EPSG:4326 EPSG:9804"
    wfs_title "Hamnar"   ##required
  END
  DUMP TRUE
  TYPE POINT
  STATUS ON
  DEBUG ON
  CONNECTIONTYPE postgis
  CONNECTION "user=postgres password=xxxxxx dbname=yyyyy 
host=localhost"
  DATA 'the_geom from hamnar'
  PROCESSING "CLOSE_CONNECTION=DEFER"
  PROJECTION
    "init=epsg:4326" ##recommended
  END
  MINSCALE 0 # Set by merge script
  LABELITEM "hamn"
  CLASS
    NAME Hamnar_CLS
    STYLE
      SYMBOL 'circle'
      COLOR 136 152 139  # Set by merge script, S52 CHGRD (Gray)
      SIZE 8
    END
    STYLE
      SYMBOL 'circle'
      COLOR 238 90 108  # Set by merge script, S52 CHRED (Red)
      SIZE 5
    END
    LABEL
      TYPE truetype
      FONT 'arial'
      COLOR 7 7 7  # Set by merge script, S52 CHBLK (Black)
      SIZE 10
      POSITION ul
    END
  END
END


I would appreciate if somebody could give me a hint of what's causing the 
error.

/Regards Bengt



More information about the mapserver-users mailing list