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
I see two possibilities for why this is happening:
- a test that mocks
Redixdoesn’t tear down the mock cleanly; the next piece of code to try to callRedix.commandgets the error - a test that mocks
Redixis reconfiguring modules exactly at the moment theVerk.QueueManagertries 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
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
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.
Popular in Questions
Other popular topics
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
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









