When an exception happens in the postgis_datasource constructor, the ~postgis_datasource is never called (because the object was never fully created). Therefore, even if persist_connection=false, the connection pool entry for that datasource is never released. This makes it very difficult to write tests against the postgis datasource where databases need to get cleaned up because even at script exit mapnik's pool will still be holding onto a connection.
This also related a bit to #863
Datasource should never bind themselves in the constructor. Like what Artem said, it's better to move the logic in the datasource management layer underneath, and catch exceptions there.
I just got this in the tip of 2.1.x branch and really need to fix it, or the number of connections to the DB keeps growing indefinitely.
This is fixed by pulls #1709 (for 2.1.x) and #1707 (for master)