You are calling the setup_geoip functin, but not teardown_geoip? For the other DB connection it matters, as otherwise SQLAlchemy keeps connection pools around until the last reference to the pool is garbage collected.