[GRASS-dev] [GRASS GIS] #2627: v.out.postgis uses wrong database name or port

GRASS GIS trac at osgeo.org
Mon Mar 16 10:50:05 PDT 2015


#2627: v.out.postgis uses wrong database name or port
-------------------------------------------+--------------------------------
 Reporter:  wenzeslaus                     |       Owner:  grass-dev@…              
     Type:  defect                         |      Status:  new                      
 Priority:  normal                         |   Milestone:  7.1.0                    
Component:  Default                        |     Version:  svn-trunk                
 Keywords:  PostgreSQL, postgres, PostGIS  |    Platform:  Unspecified              
      Cpu:  Unspecified                    |  
-------------------------------------------+--------------------------------
 After using `db.connect` and `db.login`:

 {{{
 db.connect driver=pg database="host=0.0.0.0,port=25432,dbname=gis"
 db.login user=docker password=docker
 }}}

 v.out.postgis uses wrong database name or port (or both) and then fails to
 connect to the database and then crashes or hangs.

 In the following reports I used `g.gisenv set=DEBUG=5` but the behavior is
 the same for no debug. Note the name of database in debug messages is once
 "grass", then NULL and then "grass" plus some unknown/non-printable
 character. It also seems that it calls the `read_file()` function twice.
 Finally, it mentions 5432 before it ends.

 Hangs:

 {{{
 D2/5: V1_open_new_pg(): name = busroutesall with_z = 0
 D1/5: V1_open_new_pg(): conninfo='dbname=grass' table='busroutesall'
 D3/5: db_get_login(): drv=[pg] db=[grass]
 D3/5: read_file(): DB login file = </home/vpetras/.grass7/dblogin>
 D3/5: ret = 4 : drv=[pg] db=[host=localhost,port=25432,dbname=gis]
 usr=[docker] pwd=[docker]
 D3/5: db_get_login(): drv=[pg] db=[(null)]
 D3/5: read_file(): DB login file = </home/vpetras/.grass7/dblogin>
 D3/5: ret = 4 : drv=[pg] db=[host=localhost,port=25432,dbname=gis]
 usr=[docker] pwd=[docker]
 D1/5:    PQconnectdb(): dbname=grass user=docker password=docker
 ERROR: Connection to PostgreSQL database failed. Try to set up
        username/password by db.login.
        could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket
        "/var/run/postgresql/.s.PGSQL.5432"?
 D1/5: Vect_close(): name = busroutesall, mapset = PERMANENT, format = 0,
 level = 2, is_tmp = 0
 D1/5: spatial index file closed
 D1/5: close history file
 D1/5: V1_close_nat(): name = busroutesall mapset= PERMANENT
 D1/5: file_handler: PG_27099
 D2/5: G_file_name(): path = /grassdata//nc_spm/postgis_test1/PG_27099
 }}}

 Aborted with "free(): invalid pointer":

 {{{
 D2/5: V1_open_new_pg(): name = busroutesall with_z = 0
 D1/5: V1_open_new_pg(): conninfo='dbname=grass' table='busroutesall'
 D3/5: db_get_login(): drv=[pg] db=[grass]
 D3/5: read_file(): DB login file = </home/vpetras/.grass7/dblogin>
 D3/5: ret = 4 : drv=[pg] db=[host=localhost,port=25432,dbname=gis]
 usr=[docker] pwd=[docker]
 D3/5: db_get_login(): drv=[pg] db=[(null)]
 D3/5: read_file(): DB login file = </home/vpetras/.grass7/dblogin>
 D3/5: ret = 4 : drv=[pg] db=[host=localhost,port=25432,dbname=gis]
 usr=[docker] pwd=[docker]
 D1/5:    PQconnectdb(): dbname=grass user=docker password=docker
 ERROR: Connection to PostgreSQL database failed. Try to set up
        username/password by db.login.
        could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket
        "/var/run/postgresql/.s.PGSQL.5432"?
 D1/5: Vect_close(): name = busroutesall, mapset = PERMANENT, format = 0,
 level = 2, is_tmp = 0
 D1/5: spatial index file closed
 D1/5: close history file
 D1/5: V1_close_nat(): name = busroutesall mapset= PERMANENT
 D1/5: file_handler: PG_27257
 D2/5: G_file_name(): path = /grassdata//nc_spm/postgis_test1/PG_27257
 dbmi: Protocol error
 * Error in `v.out.postgis': free(): invalid pointer: 0x00007f6fed3977e8 *
 Aborted (core dumped)
 }}}

 Segmentation fault:

 {{{
 D2/5: V1_open_new_pg(): name = busroutesall with_z = 0
 D1/5: V1_open_new_pg(): conninfo='dbname=grass' table='busroutesall'
 D3/5: db_get_login(): drv=[pg] db=[grass]
 D3/5: read_file(): DB login file = </home/vpetras/.grass7/dblogin>
 D3/5: ret = 4 : drv=[pg] db=[host=localhost,port=25432,dbname=gis]
 usr=[docker] pwd=[docker]
 D3/5: db_get_login(): drv=[pg] db=[(null)]
 D3/5: read_file(): DB login file = </home/vpetras/.grass7/dblogin>
 D3/5: ret = 4 : drv=[pg] db=[host=localhost,port=25432,dbname=gis]
 usr=[docker] pwd=[docker]
 D1/5:    PQconnectdb(): dbname=grass user=docker password=docker
 ERROR: Connection to PostgreSQL database failed. Try to set up
        username/password by db.login.
        could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket
        "/var/run/postgresql/.s.PGSQL.5432"?
 D1/5: Vect_close(): name = busroutesall, mapset = PERMANENT, format = 0,
 level = 2, is_tmp = 0
 D1/5: spatial index file closed
 D1/5: close history file
 D1/5: V1_close_nat(): name = busroutesall mapset= PERMANENT
 D1/5: file_handler: PG_27267
 D2/5: G_file_name(): path = /grassdata//nc_spm/postgis_test1/PG_27267
 dbmi: Protocol error
 Segmentation fault (core dumped)
 }}}


 Similar applies to the case when v.out.postgis is used without `db.login`.
 Sometimes in hangs, sometimes it segfaults:

 {{{
 v.out.postgis -l input=busroutesall output="PG:dbname=grass"
 ERROR: Connection to PostgreSQL database failed. Try to set up
        username/password by db.login.
        could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket
        "/var/run/postgresql/.s.PGSQL.5432"?
 dbmi: Protocol error
 Segmentation fault (core dumped)
 }}}

 Same as in #2626, I hope I'm not missing something, e.g. from manual or
 messages. The special thing about my environment is that I'm using
 PostgreSQL database in a Docker container from  kartoza/postgis. I used
 their steps to run it and psql works for me (in GRASS session):

 {{{
 psql -h localhost -U docker -p 25432 -l
 }}}

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/2627>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list