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 ?
Only the queries for the working tiles show up in the postgresql log. No trace in the postgresql log about any connection error.
The error message comes from mapnik itself. Debugging it now.
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 ?
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:
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...
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"
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.
Do not set postgresql.max_size=0, doesn't work as expected (#16)
max_size=0 commented out, matching production (and fixing this issue for me), in 0a305a9
Do not query CDB_TableMetadata for queries affected by no tables
Oops, previous commit closed #168, not #16