RAII problems in postgis.input #960

Closed
springmeyer opened this Issue Nov 20, 2011 · 3 comments

Projects

None yet

3 participants

Owner

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

Member

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.

Contributor
strk commented Jan 30, 2013

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.

Contributor
strk commented Jan 31, 2013

This is fixed by pulls #1709 (for 2.1.x) and #1707 (for master)

@springmeyer springmeyer closed this May 6, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment