New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too many connections error when running large test suite (ZF2, Doctrine2) #2060

Closed
dranzd opened this Issue Jun 17, 2015 · 4 comments

Comments

Projects
None yet
5 participants
@dranzd
Contributor

dranzd commented Jun 17, 2015

This is kind of similar to issue #1591 but using ZF2 and Doctrine2.

If run in small number of test suites, it works fine. But when all test suites are run then I get the error:

[Doctrine\DBAL\Exception\DriverException] An exception occured in driver: SQLSTATE[08004] [1040] Too many connections

A similar work around as #1591 is to close the connection after each test

    public function _after(FunctionalTester $I)
    {
        \Codeception\Module\Doctrine2::$em->getConnection()->close();
    }

This also fixes the problem if the code below is added in the Doctrine2 module but I'm not sure if that's the correct solution for this problem.

class Doctrine2 extends \Codeception\Module
{
    ...
    public function _after(\Codeception\TestCase $test)
    {
        ...
        self::$em->getConnection()->close();
    }

@DavertMik DavertMik added the Doctrine label Jun 26, 2015

@dynasource

This comment has been minimized.

Show comment
Hide comment
@dynasource

dynasource Jul 14, 2015

Contributor

try PDO::ATTR_PERSISTENT => true
#1363

Contributor

dynasource commented Jul 14, 2015

try PDO::ATTR_PERSISTENT => true
#1363

dranzd added a commit to dranzd/Codeception that referenced this issue Dec 10, 2015

Fix issue #2060 - Too many connections error
Close Doctrine2 connection after each test to prevent throwing an
exception "[Doctrine\DBAL\Exception\DriverException] An exception occured
in driver: SQLSTATE[08004] [1040] Too many connections" with a large
test suite

DavertMik added a commit that referenced this issue Dec 15, 2015

Merge pull request #2625 from dranzd/fix-issue-2060
Fix issue #2060 - Too many connections error
@dranzd

This comment has been minimized.

Show comment
Hide comment
@dranzd

dranzd Dec 16, 2015

Contributor

Can this be closed since the fix was already merged?

Contributor

dranzd commented Dec 16, 2015

Can this be closed since the fix was already merged?

@Naktibalda Naktibalda closed this Dec 16, 2015

@sitaprajapati

This comment has been minimized.

Show comment
Hide comment
@sitaprajapati

sitaprajapati Feb 10, 2016

Even in codeception 2.1.5, Too many connections errors are getting

sitaprajapati commented Feb 10, 2016

Even in codeception 2.1.5, Too many connections errors are getting

@dranzd

This comment has been minimized.

Show comment
Hide comment
@dranzd

dranzd Mar 18, 2016

Contributor

@sitaprajapati After the fix was merged I've never seen that error. If you are still experiencing the issue I suggest you open another issue and provide more details or if you can provide a PR would be great.

Contributor

dranzd commented Mar 18, 2016

@sitaprajapati After the fix was merged I've never seen that error. If you are still experiencing the issue I suggest you open another issue and provide more details or if you can provide a PR would be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment