zacksiri

zacksiri

I’m having trouble enabling async: true in my tests that involved GRPC endpoints.

I get the following error:

10:46:17.210 [error] ** (DBConnection.OwnershipError) cannot find ownership process for #PID<0.6663.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
async.

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.
    (ecto_sql 3.10.2) lib/ecto/adapters/sql.ex:1044: Ecto.Adapters.SQL.raise_sql_call_error/1
    (ecto_sql 3.10.2) lib/ecto/adapters/sql.ex:945: Ecto.Adapters.SQL.execute/6
    (ecto 3.10.3) lib/ecto/repo/queryable.ex:229: Ecto.Repo.Queryable.execute/4
    (ecto 3.10.3) lib/ecto/repo/queryable.ex:19: Ecto.Repo.Queryable.all/3
    (ecto 3.10.3) lib/ecto/repo/queryable.ex:151: Ecto.Repo.Queryable.one/3
    (insterra 0.1.0) lib/insterra_grpc/servers/blueprint_server.ex:369: InsterraGRPC.BlueprintServer.update_component/2
    (grpc 0.7.0) lib/grpc/server.ex:187: anonymous fn/6 in GRPC.Server.call_with_interceptors/4
    (grpc 0.7.0) lib/grpc/telemetry.ex:94: anonymous fn/2 in GRPC.Telemetry.server_span/5
    (telemetry 1.2.1) /Users/zacksiri/Development/_upmaru/insterra/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3
    (grpc 0.7.0) lib/grpc/telemetry.ex:93: GRPC.Telemetry.server_span/5
    (grpc 0.7.0) lib/grpc/server/adapters/cowboy/handler.ex:376: GRPC.Server.Adapters.Cowboy.Handler.do_call_rpc/3
    (grpc 0.7.0) lib/grpc/server/adapters/cowboy/handler.ex:349: GRPC.Server.Adapters.Cowboy.Handler.call_rpc/3

The app is just a phoenix app, and I have my own custom GRPC endpoint in the application.ex

If I just use Insterra.DataCase without async: true tests run without any issues. I’ve looked online to find examples of how people test their GRPC endpoint and couldn’t find any.

Here is how i setup my GPRC conn for tests

setup do
  port = Enum.random(20000..20999)

  {:ok, _server_pid} =
      start_supervised(
        {GRPC.Server.Supervisor, endpoint: InsterraGRPC.Endpoint, port: port, start_server: true},
        []
      )

  {:ok, conn} = GRPC.Stub.connect("localhost:#{port}")

  {:ok, conn: conn}
end

Where Next? Top

Trending in Questions Top

katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
achenet
Hello, I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind. However, when I launch mix phx.server, I get an error...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
Cxx-mlr
I’m working on a small exercise involving update_in/3, and I came up with this solution: data = %{ name: "Periodic Table", category:...
New
ChrisAmelia
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication): toke...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews