Fix (or silence?) occasional postgrex connection error in tests
Nobody has claimed this yet.
- Dominant language
- Elixir
- Stars
- 296
- Forks
- 86
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 50
Description
This doesn't result in test failures, but all the red text could be distracting or misleading to devs debugging other failing tests: 07:59:05.968 [error] Postgrex.Protocol (#PID<0.1793.0>) disconnected: ** (DBConnection.ConnectionError) client #PID<0.3956.0> exited
The logs are:
07:59:09.327 [error] Postgrex.Protocol (#PID<0.1798.0>) disconnected: ** (DBConnection.ConnectionError) owner #PID<0.5222.0> exited
Client #PID<0.5268.0> is still using a connection from owner at location:
:prim_inet.recv0/3
(postgrex 0.16.5) lib/postgrex/protocol.ex:3171: Postgrex.Protocol.msg_recv/4
(postgrex 0.16.5) lib/postgrex/protocol.ex:2871: Postgrex.Protocol.recv_transaction/4
(postgrex 0.16.5) lib/postgrex/protocol.ex:2180: Postgrex.Protocol.rebind_execute/4
(ecto_sql 3.9.0) lib/ecto/adapters/sql/sandbox.ex:375: Ecto.Adapters.SQL.Sandbox.Connection.proxy/3
(db_connection 2.4.2) lib/db_connection/holder.ex:354: DBConnection.Holder.holder_apply/4
(db_connection 2.4.2) lib/db_connection.ex:1364: DBConnection.run_execute/5
(db_connection 2.4.2) lib/db_connection.ex:1459: DBConnection.run/6
(db_connection 2.4.2) lib/db_connection.ex:652: DBConnection.execute/4
(ecto_sql 3.9.0) lib/ecto/adapters/postgres/connection.ex:102: Ecto.Adapters.Postgres.Connection.execute/4
(ecto_sql 3.9.0) lib/ecto/adapters/sql.ex:850: Ecto.Adapters.SQL.execute!/5
(ecto_sql 3.9.0) lib/ecto/adapters/sql.ex:820: Ecto.Adapters.SQL.execute/6
(ecto 3.9.1) lib/ecto/repo/queryable.ex:229: Ecto.Repo.Queryable.execute/4
(ecto 3.9.1) lib/ecto/repo/queryable.ex:19: Ecto.Repo.Queryable.all/3
(ecto 3.9.1) lib/ecto/repo/preloader.ex:272: Ecto.Repo.Preloader.fetch_query/8
(elixir 1.14.1) lib/task/supervised.ex:89: Task.Supervised.invoke_mfa/2
(elixir 1.14.1) lib/task/supervised.ex:34: Task.Supervised.reply/4
(stdlib 4.1.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
The connection itself was checked out by #PID<0.5268.0> at location:
(ecto_sql 3.9.0) lib/ecto/adapters/postgres/connection.ex:102: Ecto.Adapters.Postgres.Connection.execute/4
(ecto_sql 3.9.0) lib/ecto/adapters/sql.ex:850: Ecto.Adapters.SQL.execute!/5
(ecto_sql 3.9.0) lib/ecto/adapters/sql.ex:820: Ecto.Adapters.SQL.execute/6
(ecto 3.9.1) lib/ecto/repo/queryable.ex:229: Ecto.Repo.Queryable.execute/4
(ecto 3.9.1) lib/ecto/repo/queryable.ex:19: Ecto.Repo.Queryable.all/3
(ecto 3.9.1) lib/ecto/repo/preloader.ex:272: Ecto.Repo.Preloader.fetch_query/8
(elixir 1.14.1) lib/task/supervised.ex:89: Task.Supervised.invoke_mfa/2
(elixir 1.14.1) lib/task/supervised.ex:34: Task.Supervised.reply/4
(stdlib 4.1.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the test suite and tracing the disconnect through Ecto.Adapters.SQL.Sandbox.Connection.proxy/3 and Postgrex.Protocol.msg_recv/4, the entry points shown in the logs. Inspect the test database setup to determine why the owner or client exits during a query. Done means the intermittent red Postgrex errors are addressed or silenced without hiding genuine test failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elixir, postgresql
- Domain
- databases, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100