symfony/symfony — Issue #2514: Dangling database connections in test cases cause test failures
Author: mgruner
Created: 2011-10-29 06:25:21+00:00
State: open

For any Symfony application that uses Doctrine to work with a (PostgreSQL, in my case) database, there seems to be a general problem with too many (dangling) database connections filling up the connection slots of the database. Just by making many requests with the Client object of Symfony.

This will lead to an error like:
```
[2011-10-29 08:14:03] request.CRITICAL: PDOException: SQLSTATE[08006] [7] FATAL: remaining connection slots are reserved for non-replication superuser connections (uncaught exception) at /myproject/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php line 36 [] []
```

I tried different things. PHPUnit's process isolation does not work togehter with Doctrine/Symfony, and using persistent PDO connections is also not possible with Doctrine. Can you give me a tip how to achieve this? Btw, I'm using Symfony SE 2.0.4.

Or is it impossible to create more test cases than the number of available connection slots in the database server?