Fwd: [MAPSERVER-USERS] CLOSE_CONNECTION=DEFER - Segmentation fault

Ivan Mincik ivan.mincik at gmail.com
Mon Mar 17 13:42:21 EDT 2008


Hi,
how is the situation about the patch? Can I try some?

Thanks for Your time
Ivan

On Wednesday 12 March 2008 23:45, you wrote:
> Oops, forgot to CC mapserver-users.
>
> ---------- Forwarded message ----------
> From: Dave Fuhry <dfuhry at gmail.com>
> Date: Wed, Mar 12, 2008 at 6:33 PM
> Subject: Re: [MAPSERVER-USERS] CLOSE_CONNECTION=DEFER - Segmentation fault
> To: Ivan Mincik <ivan.mincik at gmail.com>
>
>
> Ivan,
>
>    Ah, that does help.  It looks like the error:
>
> ERROR:  DECLARE CURSOR may only be used in transaction blocks
>  is occurring after ROLLBACK statements are issued.  I had not really
>  considered ROLLBACKs, not having seen them in my tests.
>
>  ROLLBACKs are only issued in two places in mappostgis.c.  In
>  msPOSTGISLayerGetShape(), and in prepare_database() (but in the latter
>  case, only if using an ancient version of postgis).
>
>  The code in msPOSTGISLayerGetShape() seems unnecessary to me; no other
>  DECLARE CURSOR ...; FETCH ...; CLOSE ...; queries are followed by a
>  ROLLBACK, so it seems unnecessary here as well.  The important thing
>  will be to ensure that if an error happens in one of those queries,
>  that the connection is not msConnPoolRelease()d back into the
>  connection pool.  I haven't traced the code in detail yet, but that
>  should be staightforward enforce.
>
>  So essentially, the patch should be modified to remove the ROLLBACKs
>  from msPOSTGISLayerGetShape() in a safe way.
>
>  Thanks,
>
>  Dave
>
>  On Wed, Mar 12, 2008 at 5:49 AM, Ivan Mincik <ivan.mincik at gmail.com> wrote:
>  > Hi Dave,
>  >  these are my postgis version details:
>  >  select postgis_full_version();
>  >                                postgis_full_version
>  > 
>  > ------------------------------------------------------------------------
>  >---------- POSTGIS="1.3.1" GEOS="2.2.3-CAPI-1.1.1" PROJ="Rel. 4.5.0, 22
>  > Oct 2006" USE_STATS
>  >  (1 row)
>  >
>  >  1. I have changed value log_min_duration_statement
>  >  2. Restart of postgresql
>  >  3. Restart of apache
>  >  4. Restart of all firefox windows and deleted cache
>  >  5. pmapper loaded
>  >
>  >  Here are two logs when reproducing the problem:
>  >  http://projects.gpsmapy.sk/logs/
>  >
>  >  I have tried to use mapserver also as fastcgi, but same problem. Every
>  > time the problem will start when I try to identify the object
>  >  (Obj_queryBy{Point,Rect,etc.}).
>  >
>  >  Thanks a lot
>  >  Ivan
>  >
>  >  On Wednesday 12 March 2008 04:41, you wrote:
>  >  > Ivan,
>  >  >
>  >  >    p.mapper seems to use the typical php
>  >  > {map,layer}Obj_queryBy{Point,Rect,etc.} functions.  These calls end
>  >  > up calling the same msPOSTGIS* functions as everything else.
>  >  >
>  >  >    I can't seem to reproduce your problem with a simple testcase
>  >  > (basically, the attached files).  It might help if you can set
>  >  > log_min_duration_statement = 0 in your postgresql.conf, reproduce the
>  >  > problem, and send the output from your postgresql log file.  It will
>  >  > show all commands issued to the database, including the BEGIN, and
>  >  > the DECLARE CURSOR ..., and FETCH for every layer.
>  >  >
>  >  >    I can setup p.mapper if that's necessary to reproduce the problem.
>  >  >
>  >  >   (By the way, I assume you're not using an ancient version of
>  >  > postgis, in the 0.5 - 0.6 era.  There is an alternate codepath for
>  >  > that, which I have not tested.)
>  >  >
>  >  > Thanks,
>  >  >
>  >  > Dave
>  >  >
>  >  > On Sun, Mar 9, 2008 at 5:31 AM, Ivan Mincik <ivan.mincik at gmail.com> 
wrote:
>  >  > > I am sorry for late reply,
>  >  > >  I am testing mapserver with p.mapper application so I *don't* use
>  >  > > it as cgi/fcgi.
>  >  > >
>  >  > >  I have downloaded source package of mapserver 5.0.2 from debian
>  >  > > unstable, applied a patch and compiled on Debian Etch.
>  >  > >  Installed and restarted apache and also rebooted whole system few
>  >  > > times (I am testing this on my desktop computer).
>  >  > >
>  >  > >  The problems are starting mostly when I am trying to use
>  >  > > p.mapper's identify function, to get attributes of map object. Then
>  >  > > p.mapper is freezing. In mapfile i have 7 postgis layers.
>  >  > >
>  >  > >  I can try this also with some openlayers which is using cgi.
>  >  > >
>  >  > >  LOGS:
>  >  > >
>  >  > >  2008-03-09 10:24:44 CET WARNING:  there is already a transaction
>  >  > > in progress 2008-03-09 10:24:45 CET WARNING:  there is already a
>
> transaction
>
>  >  > > in progress 2008-03-09 10:24:46 CET ERROR:  DECLARE CURSOR may only
>  >  > > be used in transaction blocks
>  >  > >  2008-03-09 10:24:46 CET WARNING:  there is no transaction in
>  >  > > progress 2008-03-09 10:24:46 CET ERROR:  cursor "mycursor" does not
>  >  > > exist 2008-03-09 10:24:46 CET ERROR:  DECLARE CURSOR may only be
>  >  > > used in transaction blocks
>  >  > >  2008-03-09 10:24:46 CET WARNING:  there is no transaction in
>  >  > > progress 2008-03-09 10:24:47 CET ERROR:  cursor "mycursor" does not
>  >  > > exist 2008-03-09 10:24:47 CET ERROR:  DECLARE CURSOR may only be
>  >  > > used in transaction blocks
>  >  > >  2008-03-09 10:24:47 CET WARNING:  there is no transaction in
>  >  > > progress 2008-03-09 10:24:47 CET ERROR:  cursor "mycursor" does not
>  >  > > exist 2008-03-09 10:24:50 CET ERROR:  DECLARE CURSOR may only be
>  >  > > used in transaction blocks
>  >  > >  2008-03-09 10:24:50 CET WARNING:  there is no transaction in
>  >  > > progress 2008-03-09 10:24:50 CET ERROR:  cursor "mycursor" does not
>  >  > > exist 2008-03-09 10:24:52 CET ERROR:  DECLARE CURSOR may only be
>  >  > > used in transaction blocks
>  >  > >  2008-03-09 10:24:52 CET WARNING:  there is no transaction in
>  >  > > progress 2008-03-09 10:24:52 CET ERROR:  cursor "mycursor" does not
>  >  > > exist 2008-03-09 10:24:53 CET ERROR:  DECLARE CURSOR may only be
>  >  > > used in transaction blocks
>  >  > >  2008-03-09 10:24:53 CET WARNING:  there is no transaction in
>  >  > > progress 2008-03-09 10:24:53 CET ERROR:  cursor "mycursor" does not
>  >  > > exist 2008-03-09 10:24:54 CET ERROR:  DECLARE CURSOR may only be
>  >  > > used in transaction blocks
>  >  > >  2008-03-09 10:24:54 CET WARNING:  there is no transaction in
>  >  > > progress 2008-03-09 10:24:54 CET ERROR:  cursor "mycursor" does not
>  >  > > exist 2008-03-09 10:24:54 CET ERROR:  DECLARE CURSOR may only be
>  >  > > used in transaction blocks
>  >  > >  2008-03-09 10:24:54 CET WARNING:  there is no transaction in
>  >  > > progress 2008-03-09 10:24:54 CET ERROR:  cursor "mycursor" does not
>  >  > > exist 2008-03-09 10:24:55 CET ERROR:  DECLARE CURSOR may only be
>  >  > > used in transaction blocks
>  >  > >  2008-03-09 10:24:55 CET WARNING:  there is no transaction in
>  >  > > progress 2008-03-09 10:24:55 CET ERROR:  cursor "mycursor" does not
>  >  > > exist 2008-03-09 10:25:00 CET ERROR:  DECLARE CURSOR may only be
>  >  > > used in transaction blocks
>  >  > >  2008-03-09 10:25:00 CET WARNING:  there is no transaction in
>  >  > > progress 2008-03-09 10:25:00 CET ERROR:  cursor "mycursor" does not
>  >  > > exist 2008-03-09 10:25:00 CET ERROR:  DECLARE CURSOR may only be
>  >  > > used in transaction blocks
>  >  > >  2008-03-09 10:25:00 CET WARNING:  there is no transaction in
>  >  > > progress 2008-03-09 10:25:01 CET ERROR:  cursor "mycursor" does not
>  >  > > exist
>  >  > >
>  >  > >
>  >  > >  Thanks a lot
>  >  > >  Ivan
>  >  > >
>  >  > >  On Wednesday 05 March 2008 22:41, you wrote:
>  >  > >  > Ivan,
>  >  > >  >
>  >  > >  >    Thanks for the problem report.  If you are using fastcgi, you
>  >  > >  > may need to restart it.
>  >  > >  >
>  >  > >  >    The only two places PQconnectdb is called is in
>  >  > >  > msPOSTGISLayerOpen and in msPOSTGRESQLJoinConnect, which
>  >  > >  > operates independently, not using cursors or the connection
>  >  > >  > pool.  With a patched
>  >  > >  > msPOSTGISLayerOpen, PQexec(layerinfo->conn, "BEGIN") is always
>  >  > >  > called right after connecting, before any queries and before the
>  >  > >  > connection ends up in the connection pool.
>  >  > >  >
>  >  > >  >    So I'm wondering if you've put the new mapserv executable in
>  >  > >  > your cgi-bin, but not restarted the webserver, and it's pulling
>  >  > >  > old connections out of the fastcgi connection pool, which have
>  >  > >  > not had PQexec(layerinfo->conn, "BEGIN") issued to them (and
>  >  > >  > thus, no transaction started).
>  >  > >  >
>  >  > >  >    Try restarting fastcgi.  Depending on your configuration,
>  >  > >  > restarting your webserver may automatically restart fastcgi, or
>  >  > >  > you may have to specifically restart the fastcgi service/daemon
>  >  > >  > on that machine.
>  >  > >  >
>  >  > >  >    Please let us know if this fixes the problem.
>  >  > >  >
>  >  > >  > Thanks,
>  >  > >  >
>  >  > >  > Dave
>  >  > >  >
>  >  > >  > On Wed, Mar 5, 2008 at 7:26 AM, Ivan Mincik
>  >  > >  > <ivan.mincik at gmail.com>
>  >
>  >  wrote:
>  >  > >  > > Nothing is perfect. There are no problems with applied patch
>  >  > >  > > when browsing the map. But when I use identify object query
>  >  > >  > > from php5-mapscript the problem is rising again.
>  >  > >  > >
>  >  > >  > >  I have in postgresql log:
>  >  > >  > >
>  >  > >  > >   2008-03-05 13:19:30 CET WARNING:  there is no transaction in
>  >  > >  > > progress 2008-03-05 13:19:30 CET ERROR:  cursor "mycursor"
>  >  > >  > > does not exist 2008-03-05 13:19:31 CET ERROR:  DECLARE CURSOR
>  >  > >  > > may only be used in transaction blocks
>  >  > >  > >  2008-03-05 13:19:31 CET WARNING:  there is no transaction in
>  >  > >  > > progress 2008-03-05 13:19:31 CET ERROR:  cursor "mycursor"
>  >  > >  > > does not exist 2008-03-05 13:19:32 CET ERROR:  DECLARE CURSOR
>  >  > >  > > may only be used in transaction blocks
>  >  > >  > >  2008-03-05 13:19:32 CET WARNING:  there is no transaction in
>  >  > >  > > progress 2008-03-05 13:19:32 CET ERROR:  cursor "mycursor"
>  >  > >  > > does not exist 2008-03-05 13:19:34 CET ERROR:  DECLARE CURSOR
>  >  > >  > > may only be used in transaction blocks
>  >  > >  > >  2008-03-05 13:19:34 CET WARNING:  there is no transaction in
>  >  > >  > > progress 2008-03-05 13:19:34 CET ERROR:  cursor "mycursor"
>  >  > >  > > does not exist 2008-03-05 13:20:10 CET LOG:  could not receive
>  >  > >  > > data from client: Connection reset by peer
>  >  > >  > >  2008-03-05 13:20:10 CET LOG:  unexpected EOF on client
>  >  > >  > > connection 2008-03-05 13:20:10 CET LOG:  could not receive
>  >  > >  > > data from client: Connection reset by peer
>  >  > >  > >  2008-03-05 13:20:10 CET LOG:  unexpected EOF on client
>  >  > >  > > connection 2008-03-05 13:20:10 CET LOG:  autovacuum:
>  >  > >  > > processing database "gisplan" 2008-03-05 13:20:10 CET LOG: 
>  >  > >  > > could not receive data from client: Connection reset by peer
>  >  > >  > >  2008-03-05 13:20:10 CET LOG:  unexpected EOF on client
>  >  > >  > > connection 2008-03-05 13:20:10 CET LOG:  could not receive
>  >  > >  > > data from client: Connection reset by peer
>  >  > >  > >  2008-03-05 13:20:10 CET LOG:  unexpected EOF on client
>  >  > >  > > connection 2008-03-05 13:20:10 CET LOG:  could not receive
>  >  > >  > > data from client: Connection reset by peer
>  >  > >  > >  2008-03-05 13:20:10 CET LOG:  unexpected EOF on client
>  >  > >  > > connection 2008-03-05 13:20:10 CET LOG:  could not receive
>  >  > >  > > data from client: Connection reset by peer
>  >  > >  > >  2008-03-05 13:20:10 CET LOG:  unexpected EOF on client
>  >  > >  > > connection 2008-03-05 13:20:10 CET LOG:  could not receive
>  >  > >  > > data from client: Connection reset by peer
>  >  > >  > >  2008-03-05 13:20:10 CET LOG:  unexpected EOF on client
>  >  > >  > > connection 2008-03-05 13:20:10 CET LOG:  could not receive
>  >  > >  > > data from client: Connection reset by peer
>  >  > >  > >  2008-03-05 13:20:10 CET LOG:  unexpected EOF on client
>  >  > >  > > connection 2008-03-05 13:20:10 CET LOG:  could not receive
>  >  > >  > > data from client: Connection reset by peer
>  >  > >  > >  2008-03-05 13:20:10 CET LOG:  unexpected EOF on client
>  >  > >  > > connection
>  >  > >  > >
>  >  > >  > >
>  >  > >  > >  2008-03-05 13:20:40 CET WARNING:  there is already a
>
> transaction in
>
>  >  > >  > > progress 2008-03-05 13:20:40 CET WARNING:  there is already a
>  >  > >  > > transaction in progress 2008-03-05 13:20:41 CET WARNING: 
>  >  > >  > > there is already a transaction in progress 2008-03-05 13:20:42
>  >  > >  > > CET WARNING: there is already a transaction in progress
>  >  > >  > > 2008-03-05 13:20:43 CET WARNING:  there is already a
>  >  > >  > > transaction in progress 2008-03-05 13:20:43 CET WARNING: there
>  >  > >  > > is already a transaction in progress 2008-03-05 13:20:44 CET
>  >  > >  > > WARNING:  there is already a transaction in progress
>  >  > >  > > 2008-03-05 13:20:44 CET WARNING:  there is already a
>  >  > >  > > transaction in progress 2008-03-05 13:20:45 CET WARNING: 
>  >  > >  > > there is already a transaction in progress 2008-03-05 13:20:45
>  >  > >  > > CET WARNING: there is already a transaction in progress
>  >  > >  > > 2008-03-05 13:20:45 CET WARNING:  there is already a
>  >  > >  > > transaction in progress 2008-03-05 13:20:46 CET WARNING: 
>  >  > >  > > there is already a transaction in progress 2008-03-05 13:20:46
>  >  > >  > > CET WARNING:  there is already a transaction in progress
>  >  > >  > > 2008-03-05 13:20:46 CET WARNING:  there is already a
>  >  > >  > > transaction in progress 2008-03-05 13:20:47 CET WARNING: there
>  >  > >  > > is already a transaction in progress 2008-03-05 13:20:47 CET
>  >  > >  > > WARNING: there is already a transaction in progress 2008-03-05
>  >  > >  > > 13:20:48 CET WARNING:  there is already a transaction in
>  >  > >  > > progress 2008-03-05 13:20:49 CET WARNING:  there is already a
>  >  > >  > > transaction in progress 2008-03-05 13:20:50 CET WARNING: 
>  >  > >  > > there is already a transaction in progress 2008-03-05 13:20:50
>  >  > >  > > CET WARNING:  there is already a transaction in progress
>  >  > >  > >
>  >  > >  > >
>  >  > >  > >  ivan
>  >  > >  > >
>  >  > >  > >  On Monday 03 March 2008 21:53, rich.fromm wrote:
>  >  > >  > > > hrach wrote:
>  >  > >  > >  > > I use mapserver 4.10.3, postgresql 8.1, Debian Etch.
>  >  > >  > >  > >
>  >  > >  > >  > > Is anybody using CLOSE_CONNECTION=DEFER without any
>  >  > >  > >  > > problems ?
>  >  > >  > >  >
>  >  > >  > >  > I am now using it fine with mapserver 5.0.0 after applying
>  >  > >  > >  > the patch for bug 2497:
>  >  > >  > >  > http://trac.osgeo.org/mapserver/ticket/2497
>  >  > >  > >  >
>  >  > >  > >  > I don't know if 4.10.3 is different enough for that patch
>  >  > >  > >  > to be applicable or not.  But if it's not too hard to
>  >  > >  > >  > upgrade, you might want to try a later version (e.g. 5.0.2)
>  >  > >  > >  > plus that patch. Note that the patch may make it into the
>  >  > >  > >  > 5.0.3 release (it was originally targetted for 5.2).
>  >  > >  > >  >
>  >  > >  > >  > You also might want to take a look at the following related
>  >  > >  > >  > mailing list threads:
>
> http://www.nabble.com/Segmentation-fault---mapserver---postgis-to
>
>  >  > >  > >  >12653 945.h tml#a12674499
>  > > >  > >  >
>  > > >  > >  > http://www.nabble.com/postgres-transaction-warnings-to157493
>  > > >  > >  >33.ht
>  > > >  > >  >
>  >  > >  > >  >ml
>  >  > >  > >  >
>  >  > >  > >  > - Rich
>  >  > >  > >
>  >  > >  > > _______________________________________________
>  >  > >  > >  mapserver-users mailing list
>  >  > >  > >  mapserver-users at lists.osgeo.org
>  >  > >  > >  http://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the mapserver-users mailing list