quantum-core
quantum-core copied to clipboard
Issue with Phoenix code reloading?
I frequently see this error in my logs:
[error] ** (UndefinedFunctionError) undefined function
#Function<3.41462932/0 in :elixir_compiler_1>()
(quantum 3.5.0) lib/quantum/executor.ex:98: anonymous fn/4 in Quantum.Executor.run/5
(telemetry 1.2.1) /multiverse/elixir/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3
(quantum 3.5.0) lib/quantum/executor.ex:97: anonymous fn/6 in Quantum.Executor.run/5
(elixir 1.15.2) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2
(elixir 1.15.2) lib/task/supervised.ex:36: Task.Supervised.reply/4
It seems to only happen after Phoenix's code reloader runs.
Not sure how to debug further or workaround. Any advice would be appreciated!
- phoenix 1.7.7
- quantum 3.5.0
@cjbottaro Sorry for the long wait.
It seems like the function registered for a job is replaced / deleted by the code reloader.
To counteract this, I would recommend to register the function with a {Module, :function, [args]} tuple to make sure it is still reachable after recompilation.
Does this solve your issue or did you find a solution in the meantime?
Closed because of inactivity