nono.31

nono.31

Oban - Caching Ecto Statements ETS Table memory leak -> OOM

Hello

  • We’re using Oban.Pro 1.14
  • we have 23 queues
  • we use partitioning
  • we use uniqueness
  • we use local limits
  • we use global limits
  • we use rate limits
  • we use DynamicCron heavily (1800+ cron entries)
  • we have multiple nodes
  • we process millions of jobs a day

We are having an issue where our Ecto.Repo ETS table is slowly growing until we get an OOM (currently reaching our limit of 8GB).

Our Repo is mainly used for Oban.

I am trying to dig deeper into this to try to isolate where this can come from, but it seems related to internals of Oban :sweat_smile:

Here we are using 105MB after a few hours:

Some of the ETS table details at this point:

  • has 16178 references to the oban_jobs table
  • has 12 reference to name: "ecto_*

You can find a small portion of it at https://gist.githubusercontent.com/mathieurousseau/6e6529da36bc09927fb9227ed4acbebf/raw/72f46766b6acf9aede031d820e70df59577afd10/gistfile1.txt

Something I have isolated:

  • The leader ecto ets table does not grow if it does not process any jobs (probably only taking care of main Oban business and the Cron)

What can I provide to help with this investigation?
Is there some obvious configuration that you know could mitigate this? (using prepare: :unamed on ecto configuration did not change anything)

Thanks.

Mathieu

Most Liked

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

What version of Ecto are you using? I seem to recall some isssue in Ecto related to this that was fixed at one point.

sorentwo

sorentwo

Oban Core Team

As indicated, this is fundamentally an Ecto issue. There are improvements in more recent versions of Pro to compensate for this issue by disabling prepared statements for highly dynamic queries.

Aside from upgrading Ecto and Pro, you could disable prepared statements for all Repo queries with prepare: :unnamed (double check the options in the Ecto docs).

sorentwo

sorentwo

Oban Core Team

No assistance is needed. The Ecto cache (what is stored in ETS) is separate from prepared statements, and there’s no way to disable it as far as I can tell. The high cardinality of partitioned queries appears to cause the table growth, and that’s not a trivial fix on the Oban/Pro side.

We plan on overhauling those queries for reduced cardinality, speed, and flexibility in Pro v1.6. A cardinality fix may be possible as a v1.5 patch.

Where Next?

Popular in Questions Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
chokchit
** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2733ms. You can configure how long re...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
nobody
How to bind a phoenix app to a specific ip address? could not find anything about that, nowhere, unfortunately, but for me this is quite...
New
earth10
Hi, I’m just starting to build a side-project with Elixir and Phoenix and doing some basic test with Elixir alone. What strikes me is th...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
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
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New

Other popular topics Top

Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
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
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
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 43622 214
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New

We're in Beta

About us Mission Statement