Help: Perl/Mapscript Bug?
Stephen Woodbridge
woodbri at SWOODBRIDGE.COM
Thu May 5 10:21:51 PDT 2005
Hi all,
I have run into an interesting but NASTY problem with Perl/Mapscript
running in a fcgi process on Linux.
Does anyone have any ideas?
Is this a bug that has been fixed in a later release?
Particulars:
Debian Woody and Mapserver 4.01 - yes it is old, but it is a production
system and we are concerned about the performance issues are in the
later releases.
The problem is that this script is running as an apache fcgi process and
it is consuming all the system resources. An lsof shows that the
shapefiles are not getting closed after each hit. We have tried to close
the layer and undef the mapObj, but it does not fix the problem. It
seems mapscript is not closing the file handles!!!
We are going to try and test this under 4.4.1 and 4.4.2 and see what happens
Any ideas?
-Steve W.
the Perl code is like:
sub query {
my $latitude = shift;
my $longitude = shift;
## create new mapscript objec using appropriate mapfile
my $map = new mapscript::mapObj($mapfile);
return error("Can not open Mapfile: $mapfile") if not $map;
## get streets layer
my $layer = $map->getLayerByName('data');
return error("Can not open Layer: data") if not $layer;
$layer->{status} = $mapscript::MS_ON;
## open the layer or the query will fail
## WHY DOES THIS NEED TO BE DONE HERE!
$layer->open();
## build point obj using lat/lon
my $point = new mapscript::pointObj();
$point->{y} = $latitude;
$point->{x} = $longitude;
## now query the layer object using lat/longs
$layer->queryByPoint($map, $point, $mapscript::MS_SINGLE, -1.0);
## reopen layer to get results,
## you can't close it or it will lose the query info
$layer->open();
my $res = $layer->getResult(0);
## get shape obj
my $shp = new mapscript::shapeObj($layer->{type});
$layer->getShape($shp, $res->{tileindex}, $res->{shapeindex});
my $data;
my $polyline = get_shp_xy($shp);
## do stuff with polyline put results into $data
## we tried $layer->close() and undef $map here
## but it did not make a difference
return($data);
}
More information about the MapServer-users
mailing list