Testing Phoenix Channel of Elixir app on CircleCI fails intermittently

Testing Phoenix Channel of Elixir app on CircleCI fails intermittently.
We didn’t do async test so there are no reason for this error.
Do you have any idea?

[error] GenServer #PID<0.8973.0> terminating
** (DBConnection.OwnershipError) cannot find ownership process for #PID<0.8973.0>.

When using ownership, you must manage connections in one
of the four ways:

* By explicitly checking out a connection
* By explicitly allowing a spawned process
* By running the pool in shared mode
* By using :caller option with allowed process

The first two options require every new process to explicitly
check a connection out or be allowed by calling checkout or
allow respectively.

The third option requires a {:shared, pid} mode to be set.
If using shared mode in tests, make sure your tests are not

The fourth option requires [caller: pid] to be used when
checking out a connection from the pool. The caller process
should already be allowed on a connection.

If you are reading this error, it means you have not done one
of the steps above or that the owner process has crashed.

See Ecto.Adapters.SQL.Sandbox docs for more information.

it’s tricky to tell without much more code. There’s a race condition somewhere.

1 Like