rails/solid_queue

ActiveStorage::AnalyzeJob jobs not running

Closed this issue · 10 comments

Hey,

I've got some ActiveStorage::AnalyzeJob jobs not running (in development, haven't checked other envs).
They're enqueued to the default queue (automatically by ActiveStorage).

Capture d’écran, le 2024-03-07 à 15 19 09

However, other ActiveJob jobs are also enqueued to the default queue but are processed as expected.
Since other jobs going through the default queue are processed, ActiveStorage::AnalyzeJob should run as well, right?

Capture d’écran, le 2024-03-07 à 15 19 18

This is how I start jobs jobs: bundle exec rake solid_queue:start
config file

default: &default
  workers:
    - queues: "critical"
      threads: 10
    - queues: "mailers"
      threads: 5
    - queues: "default"
      threads: 2
    - queues: ["low", "*"]
      threads: 1

development:
  <<: *default
  dispatchers:
    - polling_interval: 5 # default is 1
  workers:
    - polling_interval: 1 # default is 0.1

test:
  <<: *default

production:
  <<: *default
rosa commented

Hey @olimart! Yes, they should run just in the same way if they are in the default queue. However, in your screenshot I see they are indeed running, your first screenshot shows the job in progress, which means it has been picked up by a Solid Queue worker that's running it. It seems the job is hanging for some reason 🤔 To debug it, perhaps you could try to run what the job does manually in your console, as:

ActiveStorage::Blob.find(5).analyze

and see if that gives you a clue. It doesn't seem like a Solid Queue problem from what I gather, though.

Same problem here. ActiveStorage::Blob.find(NN).analyze runs without incident.

Thanks Rosa. Will take another look but ActiveStorage::Blob.find(5).analyze runs fine.
What could happen if, like you mentioned, it is in progress (picked up by Solid Queue) but hanging?

rosa commented

Hmm... Could you copy your database.yml configuration?

Hmm... Could you copy your database.yml configuration?

default: &default
  adapter: postgresql
  encoding: unicode
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>

development:
  <<: *default
  database: myapp_development

Along with Puma threads_count = ENV.fetch("RAILS_MAX_THREADS") { 3 }

It's running fine on my desktop (M3), so I guess, something makes it hanging on lower specs (M2 laptop).
I'm using PG 16 in case someone notices a pattern.
Thanks @rosa

I had this exact same issue come up with my AnalyzeJob which was working fine on my windows desktop machine using ubuntu wsl. On a mac intel laptop I started getting the issue where it went to the in progress jobs, but never completed.

I tracked it back in the logs to this error:

Screenshot 2024-03-24 at 7 24 33 PM

Then found this open issue on rails related to it. rails/rails#38560

Locally in dev if I run this OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES bin/dev I no longer have the issue and eveything runs fine.

Thanks for the tip @DustinFisher will give it a try because run into it again this week 🙏

Thank you @DustinFisher ! I had the same issue on my M2 mac and this fixed it for me.

I have the exact same issue.

I see some ActiveStorage::AnalyzeJob in_progress and they never complete (on MacOS, Intel).

The only temporary workaround that works is the env variable suggested by @DustinFisher .

BTW why this issue is closed? It looks like a bug that should be fixed somewhere