if postgres is down, three failed connections are reported from one layer #954

Open
springmeyer opened this Issue Nov 16, 2011 · 0 comments

Comments

Projects
None yet
1 participant
Owner

springmeyer commented Nov 16, 2011

This only appears to happen when loaded via XML:

$ python -c "import mapnik2 as mk;m = mk.Map(1,1);mk.load_map(m,'t.xml')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
RuntimeError: Postgis Plugin: could not connect to server: Connection refused
    Is the server running on host "localhost" and accepting
    TCP/IP connections on port 5432?
could not connect to server: Connection refused
    Is the server running on host "localhost" and accepting
    TCP/IP connections on port 5432?
could not connect to server: Connection refused
    Is the server running on host "localhost" and accepting
    TCP/IP connections on port 5432? (encountered during parsing of layer 'roads' in map 't.xml')

Not from a single layer contructor:

$ python -c "import mapnik2 as m;m.PostGIS(dbname='foo',table='foo')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/mapnik2/__init__.py", line 396, in PostGIS
    return CreateDatasource(keywords)
RuntimeError: Postgis Plugin: could not connect to server: Connection refused
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

Nothing special with my data, simply a map with one postgis layer:

<Style name="roads" filter-mode="first">
  <Rule>
    <Filter>([highway] = 'residential')</Filter>
    <LineSymbolizer stroke-width="1" />
  </Rule>
</Style>
<Layer name="roads"
  srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
    <StyleName>roads</StyleName>
    <Datasource>
       <Parameter name="table"><![CDATA[( select way,highway,osm_id
  from planet_osm_line
  where highway in ( 'motorway', 'motorway_link',
    'trunk', 'trunk_link', 'primary', 'primary_link',
    'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 
    'residential', 'unclassified' )
  order by z_order) as roads]]></Parameter>
       <Parameter name="key_field"><![CDATA[osm_id]]></Parameter>
       <Parameter name="geometry_field"><![CDATA[]]></Parameter>
       <Parameter name="extent"><![CDATA[283767.63,6359204.3,712772.86,6711153.85]]></Parameter>
       <Parameter name="type"><![CDATA[postgis]]></Parameter>
       <Parameter name="dbname"><![CDATA[osm_belgium]]></Parameter>
       <Parameter name="host"><![CDATA[localhost]]></Parameter>
    </Datasource>
  </Layer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment