jliv22

jliv22

Addressing errors spawning off of elixir upgrade from 1.6.6 to 1.10.4

I upgraded from elixir 1.6.6 to 1.10.4. Before the upgrade all tests were passing. Now I have about 10 tests failing. At some point the application is shutdown which inevitably makes the rest of the tests fail. The shutdown is caused by this error:

16:11:29.767 [error] GenServer Verk.ScheduleManager terminating
** (UndefinedFunctionError) function Redix.command/2 is undefined or private
    (redix 0.7.1) Redix.command(#PID<0.6698.0>, ["EVALSHA", "2f42b81434c4ff28b1b82414f7e76b67a1d6e933", 1, "schedule", 1612473089])
    (verk 1.4.1) lib/verk/schedule_manager.ex:59: Verk.ScheduleManager.handle_info/3
    (stdlib 3.12.1) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib 3.12.1) gen_server.erl:711: :gen_server.handle_msg/6
    (stdlib 3.12.1) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: :fetch_scheduled
State: %Verk.ScheduleManager.State{redis: #PID<0.6698.0>}

16:11:29.768 [warn]  Pausing all queues. Max timeout: 30000

16:11:29.769 [error] GenServer #PID<0.6873.0> terminating
** (stop) exited in: GenServer.call(:"whatever-volcano.workers_manager", :pause, 5000)
    ** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
    (elixir 1.10.4) lib/gen_server.ex:1013: GenServer.call/3
    (verk 1.4.1) lib/verk/manager.ex:45: Verk.Manager.pause/1
    (verk 1.4.1) lib/verk/queues_drainer.ex:60: anonymous fn/3 in Verk.QueuesDrainer.do_terminate/1
    (elixir 1.10.4) lib/enum.ex:2111: Enum."-reduce/3-lists^foldl/2-0-"/3
    (verk 1.4.1) lib/verk/queues_drainer.ex:59: Verk.QueuesDrainer.do_terminate/1
    (stdlib 3.12.1) gen_server.erl:673: :gen_server.try_terminate/3
    (stdlib 3.12.1) gen_server.erl:858: :gen_server.terminate/10
    (stdlib 3.12.1) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: {:EXIT, #PID<0.6693.0>, :shutdown}
State: 30000

16:54:08.847 [error] Failed to fetch a job. Reason: 1

I understand the error:
** (UndefinedFunctionError) function Redix.command/2 is undefined or private
is telling me that I’m passing in 2 arguments instead of 3 to Redix.command function.
This is what’s being passed in:
Redix.command(#PID<0.6698.0>, ["EVALSHA", "2f42b81434c4ff28b1b82414f7e76b67a1d6e933", 1, "schedule", 1612473089])
Which appears congruent with what’s laid out in redix docs example:
Redix.command(conn, ["SET", "mykey", "foo"])

Also like I said, this was working before elixir upgrade so I’m at a loss as to why I’m suddenly having problems with Redix.

Any help would be greatly appreciated! Thanks ahead of time.

Most Liked

al2o3cr

al2o3cr

I see two possibilities for why this is happening:

  • a test that mocks Redix doesn’t tear down the mock cleanly; the next piece of code to try to call Redix.command gets the error
  • a test that mocks Redix is reconfiguring modules exactly at the moment the Verk.QueueManager tries to interact with Redis

You may want to consider if Verk.Supervisor and the associated machinery should be running during tests, especially tests where Redix is being replaced dynamically. I’ve mostly used Oban, which recommends running tests with job dispatching disabled.

chulkilee

chulkilee

Are you running ElixirLS in any chance at the same time? I often see competing compilation between my command and ElixirLS. When it happened, I quit vscode, remove .elixir-ls, deps, and _build directory and then recompile everything.

al2o3cr

al2o3cr

Are you using any mocking libraries or similar tools that fiddle with modules at runtime? The behavior you’re describing sounds like something (maybe in test setup?) is manipulating the definition of Redix.command and not cleaning up after itself.

Where Next?

Popular in Questions Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" =&gt; #BSON.ObjectId&lt;58eb1a7a9ad169198c3dXXXX&gt;, "email" =&gt; ...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
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
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New

Other popular topics Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29703 241
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New

We're in Beta

About us Mission Statement