Skip to content

Postgre "too many clients already" on running tests #18056

@mariomka

Description

@mariomka
  • Laravel Version: 5.4.12
  • PHP Version: PHP 7.1.0-2+deb.sury.org~xenial+1 (cli) ( NTS )
  • Database Driver & Version: psql (PostgreSQL) 9.5.5

(Running on Homestead)

Description:

On running more than 100 tests that use DatabaseMigrations the following error appears:

Illuminate\Database\QueryException: SQLSTATE[08006] [7] FATAL:  sorry, too many clients already

Steps To Reproduce:

Run more than 100 tests (methods) using DatabaseMigrations on Postgree (default max connections is 100).

I have created a repository to ease reproduce it: https://github.com/mariomka/laravel-pgsql-too-many-clients-test

While tests are running you can see Postgre connections count with:

select count(*) from pg_stat_activity;

Or full info with:

select * from pg_stat_activity;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions