Error: Postgis Plugin: bad connection #16

Closed
strk opened this Issue Apr 18, 2012 · 14 comments

2 participants

@strk

I was seeing complete tiles missing from the display of a map and when looking at the windshaft log file I found a bunch of:

[TILE RENDER ERROR]
Error: Postgis Plugin: bad connection

For other tiles it works fine so dunno what to look at.
Maybe a limit on number of client connections ?

@strk

Only the queries for the working tiles show up in the postgresql log. No trace in the postgresql log about any connection error.

@strk

The error message comes from mapnik itself. Debugging it now.

@tokumine
@strk
@strk

My database has max_connection 100.
In lib/cartodb/connection_pool.rb there's a MAX_SIZE of 300.

Should that value be configured in the environment config instead ?

@strk

Alright I succeeded in fixing this. It was the max_size parameter in the XML file. Setting it to 0 keeps growing it until it ends out of connections.

So I think there are a couple of issues here:

  1. Not limiting the maximum number of connections
  2. Leaking connections ?
@tokumine
@tokumine
@strk

So I tried to reset redis cache and see the effects. I got no leakage, but a stable 4 connections, no matter max_size=0.

I could reproduce the problem by killing windshaft node instance and restarting it.
On restart, and after a page reload, windshaft complains:

[TILE RENDER ERROR]
Error: Postgis Plugin: bad connection (no more connections in a pool of 0 unused / 1 used connections)

The debugging information in parens I added the code for in my version of mapnik.
Postgresql shows a single connection only after this kill/restart.

There must be something making windshaft choke on kill...

@strk

I'm still here, and can't fix it anymore now. redis keys are all cleared except "rails:cartodb_dev_user_2_db:clu_a_wi043"

@tokumine
@strk

Setting max_size:32 in windshaft's config/environment/development.js and flushing the XML in redis makes it work again. This time the pool has 4 records again. Sounds like max_size:0 isn't working as expected.

@strk

max_size=0 commented out, matching production (and fixing this issue for me), in 0a305a9

@strk strk closed this May 7, 2012
@tokumine
@strk strk added a commit that referenced this issue Feb 27, 2014
@strk strk Oops, previous commit closed #168, not #16
Closes #168
625642c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment