[mapserver-users] POSTGIS/Mapscript DB connection is not closing (FWD)

jeff lounsbury jeffloun at refractions.net
Tue Feb 5 12:17:43 EST 2002


I try to go to that docs page, and guess what.
"Warning: Unable to connect to PostgreSQL server: Sorry, too many clients
already in /usr/local/www/www/idocs/opendb.php on line 3 Unable to access
database"

fairly ironic I thought... :-)

Apparently either they happen to have a busy website, or else they are
experiencing the same problem as me??

I don't think that a postmaster process is supposed to spawn every time I query
something AND then never die. I'll agree with the first half, it is supposed to
be created each time to access the database , but then it should die sometime
soon after that as opposed to sitting there idle never doing anything again
until there are max_connections used and none available so that everything is
locked.

Thanks though, I will definitely read those docs and see what might be happening
as soon as the website is available...
-Jeff


trussell at mtcsc.com wrote:

> Teb,
>
> Postmaster is supposed to behave like that. It runs in the background and
> fields requests. There's some great documentation on this at
> http://www.postgresql.org/idocs/index.php?postmaster-start.html.
>
> The code you included regards a topic I've been wondering about - doing a
> postgis query from a point selection. Hope to get something working there...
>
> Tom
> ----- Original Message -----
> From: "teb" <teb at mallit.fr.umn.edu>
> To: <mapserver-users at lists.gis.umn.edu>
> Cc: <jeffloun at refractions.net>
> Sent: Monday, February 04, 2002 12:15 PM
> Subject: [mapserver-users] POSTGIS/Mapscript DB connection is not closing
> (FWD)
>
> >
> > ------------- Begin Forwarded Message -------------
> >
> > Date: Mon, 04 Feb 2002 12:19:20 -0800
> > From: jeff lounsbury <jeffloun at refractions.net>
> > X-Accept-Language: en
> > MIME-Version: 1.0
> > To: mapserver-info at lists.gis.umn.edu
> > Subject: POSTGIS/Mapscript DB connection is not closing
> > Content-Transfer-Encoding: 7bit
> >
> > After I use mapscript to query my postgis layer in my map, the
> > postmaster that got run never dies/closes?
> >
> > Anyone have any idea on why this might be happening?
> > Hhere is an exerpt of the offending mapscript code...
> >
> >     file://turn the point where the user clicked on the image into a
> lat/long
> > co-ordinate
> >         $pt = ms_newPointObj();
> >         $lat = get_lat($map->extent->minx, $map->extent->maxx, $img_x,
> > 700);
> >         $long = get_long($map->extent->miny, $map->extent->maxy, $img_y,
> > 350);
> >         $pt->setXY($lat, $long);
> >     file://query the postgis layer
> >         $layer = $map->getLayer(5);
> >         $err = @$layer->queryByPoint($pt, MS_MULTIPLE, $missby);
> >
> >         if($err == MS_FAILURE){
> >           echo "<font size=4 color=red>There were no results found, try
> > zooming in closer.</font>";
> >         }else if( $err == MS_SUCCESS){
> >           $layer->open($img->shapepath);
> >     file://save the query results into an array
> >           $i=0;
> >           $result = $layer->getResult($i);
> >           while($result != FALSE && $i < 5){
> >             $shape = $layer->getShape($result->tileindex,
> > $result->shapeindex);
> >             $value = $shape->values;
> >             $val[$i] = $value;
> >             $i++;
> >             $result =  $layer->getResult($i);
> >           }
> >           $results_found =1;
> >         }
> >         $layer->close;
> >
> >
> >
> > As well as the postgid layer in the mapfile:
> > LAYER
> >    CONNECTIONTYPE postgis
> >    NAME "mypostgis"
> >    DATA "point from usage_points"
> >    CONNECTION "host=ox user=postgres port=5555 dbname=postgis_usage"
> >    STATUS DEFAULT
> >    TYPE POINT
> >    CLASS
> >     TEMPLATE query.html
> >     MINSIZE 10
> >     SYMBOL star
> >     COLOR 250 0 25
> >    END
> >   END
> >
> > ,thanks
> > -Jeff
> >
> >
> > ------------- End Forwarded Message -------------
> >
> >
> >




More information about the mapserver-users mailing list