ArgumentError when opening Oban Web before Oban executes a job and/or the jobs table is empty
durub opened this issue · 1 comments
Precheck
- Do a quick search and make sure the bug has not yet been reported
- For support, favor using the Elixir Forum, Slack, IRC, etc.
- Be friendly and polite!
Environment
- Oban Version: 2.16.2
- Oban Web Version: 2.10.0
- PostgreSQL Version: Ubuntu 15.2-1
- Elixir & Erlang/OTP Versions (
elixir --version
): 1.14.3 with OTP 25
Current Behavior
When I run mix phx.server
and go directly to localhost:4000/my_oban_web_dashboard
, I get an ArgumentError
due to the executing
atom not being defined yet. This only happens locally due to my job queue being empty and Oban seemingly not taking any action that would define :executing
in the VM.
$ mix phx.server
[notice] :alarm_handler: {:set, {{:disk_almost_full, '/'}, []}}
[info] Running CallroxWeb.Endpoint with Bandit 1.0.0 at 127.0.0.1:4000 (http)
[info] Access CallroxWeb.Endpoint at http://localhost:4000
[info] GET /my_oban_web_dashboard
[debug] Processing with Oban.Web.DashboardLive.home/2
Parameters: %{}
Pipelines: [:restricted_apps]
[warning] Failed to send Sentry event. Cannot send Sentry event because of invalid DSN
[info] Sent 500 in 64ms
[error] GenServer #PID<0.1402.0> terminating
** (ArgumentError) errors were found at the given arguments:
* 1st argument: not an already existing atom
:erlang.binary_to_existing_atom("executing", :utf8)
(oban_web 2.10.0) lib/oban/web/query.ex:381: Oban.Web.Query.jobs_limit_query/2
(oban_web 2.10.0) lib/oban/web/query.ex:370: Oban.Web.Query.all_jobs/3
(oban_web 2.10.0) lib/oban/web/pages/jobs_page.ex:153: Oban.Web.JobsPage.handle_params/3
(phoenix_live_view 0.19.5) lib/phoenix_live_view/utils.ex:462: anonymous fn/5 in Phoenix.LiveView.Utils.call_handle_params!/5
(telemetry 1.2.1) /home/durub/dev/callrox/callrox-backend/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3
(phoenix_live_view 0.19.5) lib/phoenix_live_view/static.ex:279: Phoenix.LiveView.Static.call_mount_and_handle_params!/5
(phoenix_live_view 0.19.5) lib/phoenix_live_view/static.ex:119: Phoenix.LiveView.Static.render/3
(phoenix_live_view 0.19.5) lib/phoenix_live_view/controller.ex:39: Phoenix.LiveView.Controller.live_render/3
(phoenix 1.7.9) lib/phoenix/router.ex:432: Phoenix.Router.__call__/5
(callrox 0.1.0) lib/callrox_web/endpoint.ex:1: CallroxWeb.Endpoint.plug_builder_call/2
(callrox 0.1.0) lib/callrox_web/endpoint.ex:1: CallroxWeb.Endpoint."call (overridable 3)"/2
(callrox 0.1.0) lib/plug/debugger.ex:136: CallroxWeb.Endpoint."call (overridable 4)"/2
(callrox 0.1.0) lib/callrox_web/endpoint.ex:1: CallroxWeb.Endpoint.call/2
(phoenix 1.7.9) lib/phoenix/endpoint/sync_code_reload_plug.ex:22: Phoenix.Endpoint.SyncCodeReloadPlug.do_call/4
(bandit 1.0.0) lib/bandit/pipeline.ex:101: Bandit.Pipeline.call_plug/2
(bandit 1.0.0) lib/bandit/pipeline.ex:22: Bandit.Pipeline.run/6
(bandit 1.0.0) lib/bandit/http1/handler.ex:31: Bandit.HTTP1.Handler.handle_data/3
(bandit 1.0.0) lib/bandit/delegating_handler.ex:18: Bandit.DelegatingHandler.handle_data/3
(bandit 1.0.0) lib/thousand_island/handler.ex:399: Bandit.DelegatingHandler.handle_continue/2
Last message: {:continue, :handle_connection}
State: {%ThousandIsland.Socket{socket: #Port<0.25>, transport_module: ThousandIsland.Transports.TCP, read_timeout: 60000, span: %ThousandIsland.Telemetry{span_name: :connection, telemetry_span_context: #Reference<0.3677663161.1475870721.92549>, start_time: -576460747489641341, start_metadata: %{parent_telemetry_span_context: #Reference<0.3677663161.1475870721.92155>, remote_address: {127, 0, 0, 1}, remote_port: 39110, telemetry_span_context: #Reference<0.3677663161.1475870721.92549>}}}, %{handler_module: Bandit.InitialHandler, http_1_enabled: true, http_2_enabled: true, opts: %{http_1: [], http_2: [], websocket: []}, plug: {Phoenix.Endpoint.SyncCodeReloadPlug, {CallroxWeb.Endpoint, []}}, websocket_enabled: true}}
If I run with iex -S mix phx.server
and define the atom manually, the dashboard can be accessed without errors, without any other action besides defining the atom:
iex(1)> :executing
After defining the :executing
atom, Oban Web works normally. This only seems to happen with the :executing
state. Other states are fine regardless of past state.
When I restart my local dev server with a working Oban Web opened in the browser, it errors out when the LiveView automatically refreshes the page.
Expected Behavior
I expected Oban Web to always be accessible, even if Oban has not ran any jobs before or the jobs table is empty.
I have not had time to investigate it further and it's low priority even for me, but I thought it's worth reporting since it might not happen in your environment and might be something that only happens to some people.
It seems something that is specific to executing
and not other states (probably because it's only defined when a job executes? I'm not very familiar with the internals of the execution engine).
Thanks for all your work!
This is an interactive
mode issue. Despite the executed
atom being statically defined in oban
, it isn't available until a job runs. Will fix.