karlosmid

karlosmid

Oban jobs stuck in available state

Hi! We have following oban versions:
Oban v2.17.12
Oban.Web v2.9.7
Oban.Pro v1.4.13
Elixir:
erlang 27.0.1
elixir 1.17.2-otp-27

We have 20.8 million of messages in available state, all from same queue.
And those are stuck in that state.
Application restart does not help.
In oban web, we can not load available jobs, because we got connection error:

13:39:59.043 [error] Ch.Connection (pid<0.12344.0>) disconnected: ** (DBConnection.ConnectionError) client pid<0.94175.0> timed out because it queued and checked out the connection for longer than 15000ms

We have a lot of DBConnection errors.

How to unstuck those available jobs?

Thank you!

Marked As Solved

sorentwo

sorentwo

Oban Core Team

There are several possible reasons why jobs won’t run, but it seems specifically due to those timeout errors. Some immediate changes you can make to try and get the system unstuck:

  1. Rebuild the indexes (reindex table oban_jobs), force analyze (vacuum analyze oban_jobs)

  2. Increase the size of your RDS instance (it may be fine for normal usage, but not for a backlog of 20m jobs)

  3. Manually move most of those jobs to a scheduled state to space them out. Something like this could work to reduce the available count down to 100k jobs:

    update oban_jobs set state = 'scheduled', scheduled_at = now() + '1 hour'::interval
    where id < (select min(id) from oban_jobs where state = 'available') - 100000
    

Beyond that, here are some other suggestions once the system is moving again:

  1. Apply some of the options from the official scaling guide.
  2. Upgrade to Oban v2.19 and Pro v1.5+, primarily for the new check_available/1 implementation that optimizes the query to check for available jobs (benchmark info in the linked changelog)
  3. Upgrade to Oban Web v2.10+ (v2.11 if possible), because it uses Oban.Met for much less database impact (especially count estimates)

Also Liked

sorentwo

sorentwo

Oban Core Team

There’s a Job Lifecycle guide now :slightly_smiling_face:

sorentwo

sorentwo

Oban Core Team

It most likely will. I’ve replied in the other thread with more details, including some suggestions on how to monitor for that situation.

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

No, that is for jobs waiting in the queue to run.

Where Next?

Popular in Questions Top

chokchit
** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2733ms. You can configure how long re...
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
tduccuong
Hi, is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
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
mgjohns61585
Could someone help me? I’m making my first elixir program, number guessing game. I can’t figure out how to convert the user’s guess from ...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

Other popular topics Top

hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a &gt; b) do {:ok, "a"} end if (a &lt; b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
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
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
Qqwy
Update: How to use the Blogs &amp; Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 127089 1222
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54120 245
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement