Papillon6814

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

hectorperez

I had import_config above Oban’s config. What a silly mistake.
Many thanks @sorentwo and sorry for the inconvenience!

sorentwo

sorentwo

Oban Core Team

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

sorentwo

Oban Core Team

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

sorentwo

Oban Core Team

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.

Where Next?

Popular in Questions Top

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

Other popular topics Top

lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement