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
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
I’m trying to set up Emacs with elixir-ls via lsp-mode and credo via Flycheck. This should mostly be preconfigured as Flycheck picks up c...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming









