[mapserver-users] Need help tracking down mapserv seg fault

Johan Forsman Johan.Forsman at LA.GOV
Thu Aug 19 13:32:43 PDT 2010


This procedure does not trigger a seg fault. It appears to execute as intended based on the console output being OGR status messages followed by a binary string in PNG format.

I filtered the output for text only and the OGR messages indeed indicate success.

However, when I tried this suggestion the first time I happened to be in a different directory and there was a OGR error returned. So being near quitting-time for me it took a few moments, but I finally realized I should try to specify a full path to the CSV in the MAP-file.

That worked.

In other words, all along this was a path issue that was not evident from the console while in the correct data directory, and somehow the failure to find the csv caused the mapserv seg fault.

Note to self: Always try with full pathnames. Sometimes it really is the obvious stuff.

Thanks,
Johan.

> -----Original Message-----
> From: Daniel Morissette [mailto:dmorissette at mapgears.com]
> Sent: Wednesday, August 18, 2010 2:16 PM
> To: Johan Forsman
> Cc: mapserver-users at lists.osgeo.org
> Subject: Re: [mapserver-users] Need help tracking down mapserv seg fault
> 
> Can you reproduce the seg fault if you try the following in a shell
> window?
> 
> cd /opt/fgs/
> . setenv.sh
> /opt/fgs/www/mapserv "QUERY_STRING=map=...&...&..."
> 
> Replace the contents of the QUERY_STRING param with the values that you
> pass in you URL in the Web browser, and make sure you keep the double
> quotes around the QUERY_STRING value.
> 
> If you can reproduce the seg fault this way, then it should be possible
> to run this request in gdb and see where the seg fault happens. (Let me
> know and I can guide you through that if you are not familiar with gdb).
> 
> Daniel
> 
> 
> 
> Johan Forsman wrote:
> > Hello All:
> >
> > Please pardon the very lengthy post. I have attempted to collect as much
> data as I could think of.
> >
> > Summary:
> > FGS95 with MapServer 5.4.1 on Ubuntu Server, using OGR JOIN results in
> mapserv seg fault when run from browser, works fine from shp2img.
> >
> > Detailed:
> > I have an FGs95 install on Ubuntu Server 9.10, using MapServer 5.4.1 on
> the back with a mixed shapefile/PostGIS datastore, GeoMoose 2.2 front-end.
> Everything is working very nicely except for my current problem.
> >
> > I have a need to color polygons stored in a shapefile, CLASSified based
> on attributes in an external csv-file. Guidance found in the ether
> indicates that the only way to do this with MapServer is to use an OGR
> connection between the shapefile and the csv-file.
> > Using tips found here and there I have been able to construct a SELECT
> statement in the DATA directive that allows shp2img to create a PNG that
> looks just like I hoped it would (see attached), but I must confess that I
> don't fully understand how as the SELECT statement does not look like what
> I am used to seeing in some proprietary products. I am clearly in need of
> an OGR education (with lots of example code).
> >
> > The LAYER section in the mapfile is
> >
> > LAYER # Parish Boundary Polygon Outline Layer
> >   NAME 'parishes_on_boiladv'
> >   CONNECTIONTYPE OGR
> >   CONNECTION "webmaps_parishes.shp"
> >   DATA "SELECT * FROM webmaps_parishes LEFT JOIN 'bwa.csv'.bwa ON
> webmaps_parishes.FIPS = bwa.FIPS"
> >   STATUS default
> >   TYPE polygon
> >   CLASSITEM "PercentageOut"
> >   CLASS
> >     EXPRESSION ([PercentageOut] > 0 AND [PercentageOut] <= 10)
> >     NAME "0 - 10%"
> >     STYLE
> >       COLOR 56 168 0
> >     END
> >   END #class
> > (continues with several more classes).
> >
> > The shapefile and csv-file are stored in the same directory. Both have a
> field "FIPS" which is the field I wish to join on. The "PercentageOut"
> field is in the csv-file. The DATA statement appears to work, but I looks
> really odd to me.
> >
> > Is there a way to get a table output from the OGR JOIN to study?
> >
> > I have set DEBUG 5 at the MAP level and the LAYER level to troubleshoot,
> but the process segfaults before any error is written to the ms_error
> file. The Apache and system logs contain only this when testing from
> localhost:
> >
> > /opt/fgs/www/logs/error_log:
> > [Thu Aug 12 14:53:02 2010] [error] [client 127.0.1.1] Premature end of
> script headers: mapserv
> >
> > /var/log/messages:
> > Aug 12 14:53:02 geoview kernel: [12879514.857356] mapserv[24114]:
> segfault at 0 ip 0945e714 sp bf9058dc error 6
> >
> > I saw another post with similar issues suggesting it's a library issue,
> discussing the LD_LIBRARY_PATH environment variable not being set properly
> for the Apache user. As far as I can tell this variable points to the
> right place in /opt/fgs/, but to be certain I added a SetEnv/PassEnv
> statement in the fgs-version of httpd.conf without any change in behavior.
> >
> > In both /opt/fgs/etc/conf/httpd.conf and the local user environment I
> have
> > LD_LIBRARY_PATH set to /opt/fgs/lib:/opt/fgs/www/lib.
> >
> > Is there a way to see the environment for the Apache user? I don't know
> how important this is. As mentioned everything else has been and is
> working very well.
> >
> > Could there be some other conflicting system library picked up?
> >
> > The URL I test with is
> > /cgi-
> bin/mapserv?map=/opt/fgs/apps/geomoose2/maps/sdwp/boil_adv/webmaps_boil_ad
> visories.map&mode=map
> > and I have confirmed all works fine when pointing the URL to other
> mapfiles.
> >
> > I set the file and directory permissions to full access to all users
> temporarily to test and there is no difference in behavior.
> >
> > When I run shp2img on the same mapfile the correct image is returned and
> there are no errors indicated in the ms_error file. The only oddity I see
> is in the path used by OGROpen:
> >  msLoadMap(): 0.033s
> >  msOGRFileOpen(webmaps_parishes.shp)...
> >
> OGROPen(/opt/fgs/apps/geomoose2/maps/sdwp/boil_adv/./webmaps_parishes.shp)
> >  msConnPoolRegister(parishes_on_boiladv,webmaps_parishes.shp,0x9fdeb68)
> >  msOGRFileWhichShapes: Setting spatial filter to -10515009.640986
> 3370567.000000 -9840476.359014 3918467.000000
> >  msOGRFileNextShape: Returning shape=0, tile=0
> > *** 62 shapes snipped here, there are 64 total polygons ***
> >  msOGRFileNextShape: Returning shape=63, tile=0
> >  msOGRFileNextShape: Returning MS_DONE (no more shapes)
> >  msOGRLayerClose(webmaps_parishes.shp).
> >
> msOGRFileClose(/opt/fgs/apps/geomoose2/maps/sdwp/boil_adv/./webmaps_parish
> es.shp,-1).
> >  msConnPoolRelease(parishes_on_boiladv,webmaps_parishes.shp,0x9fdeb68)
> >  msConnPoolClose(webmaps_parishes.shp,0x9fdeb68)
> >  msDrawMap(): Layer 0 (parishes_on_boiladv), 0.118s
> >  msDrawMap(): Drawing Label Cache, 0.000s
> >  msDrawMap() total time: 0.126s
> >  msSaveImage() total time: 0.311s
> >  msFreeMap(): freeing map at 0x9d36ac8.
> >  freeLayer(): freeing layer at 0x9d3d7d8.
> >  shp2img total time: 0.472s
> >
> > What else can I test?
> >
> > If you made it this far, thanks for taking the time to read!
> >
> > I am very grateful for any and all advice.
> > ----------------------
> > Johan Forsman
> > Geologist
> > Safe Drinking Water Program
> > Louisiana Department of Health and Hospitals
> > Office of Public Health
> > Telephone: 225.342.7309
> > Telefax: 225.342.7303
> >
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > mapserver-users mailing list
> > mapserver-users at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/mapserver-users
> 
> 
> --
> Daniel Morissette
> http://www.mapgears.com/



More information about the MapServer-users mailing list