Papillon6814
[error] GenServer {Oban.Registry, {Oban, {:plugin, Oban.Plugins.Stager}}}
Hello.
I cannot run mix test due to this error.
18:22:11.758 [error] GenServer {Oban.Registry, {Oban, {:plugin, Oban.Plugins.Stager}}} terminating
** (DBConnection.OwnershipError) cannot find ownership process for #PID<0.1432.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.
(db_connection 2.4.0) lib/db_connection.ex:883: DBConnection.transaction/3
(oban 2.7.2) lib/oban/plugins/stager.ex:83: anonymous fn/2 in Oban.Plugins.Stager.handle_info/2
(telemetry 0.4.3) /Users/useeer/Documents/github/xxx/deps/telemetry/src/telemetry.erl:272: :telemetry.span/3
(oban 2.7.2) lib/oban/plugins/stager.ex:82: Oban.Plugins.Stager.handle_info/2
(stdlib 3.15.1) gen_server.erl:695: :gen_server.try_dispatch/4
(stdlib 3.15.1) gen_server.erl:771: :gen_server.handle_msg/6
(stdlib 3.15.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: :stage
I added oban in the project, and the error occurs with oban.
config.exs
config :proj, Oban,
repo: Proj.Repo,
plugins: [
Oban.Plugins.Pruner,
{Oban.Plugins.Cron,
crontab: [
# {"work", ProjWeb._Worker}
]}
],
queues: [default: 10, event: 50]
application.ex
children = [
...
{Oban, oban_config()}
]
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: Proj.Supervisor]
Supervisor.start_link(children, opts)
I don’t know where to check to solve the error.
Most Liked
hectorperez
sorentwo
The error you’re getting is definitely because plugins are running during tests.
It looks like you found the queues: false, plugins: false config, which is the proper fix. Maybe double check that everything is saved and that there aren’t any typos?
sorentwo
Overriding and merging application config is handled by Elixir/Erlang, that isn’t something that Oban is doing. Provided you have import_config "#{Mix.env()}.exs" at the end of your config.exs, everything should work as expected.
To test more you can put something like this in test.exs:
config :wikir, Random.Thing, does_this_work?: true
Then check with Application.get_env(:wikir, Random.Thing).
Last Post!
sorentwo
You shouldn’t use queues: false or plugins: false anymore. Those are handled by testing modes, and leaving the original configuration let’s Oban verify the full config in the test environment.
Popular in Questions
Other popular topics
Latest Phoenix Threads
Latest Oban Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #hex
- #security










