Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActiveStorage::AnalyzeJob jobs not running #167

Closed
olimart opened this issue Mar 7, 2024 · 13 comments
Closed

ActiveStorage::AnalyzeJob jobs not running #167

olimart opened this issue Mar 7, 2024 · 13 comments

Comments

@olimart
Copy link

olimart commented Mar 7, 2024

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
Copy link
Member

rosa commented Mar 8, 2024

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.

@arbythree
Copy link

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

@olimart
Copy link
Author

olimart commented Mar 10, 2024

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
Copy link
Member

rosa commented Mar 10, 2024

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

@olimart
Copy link
Author

olimart commented Mar 11, 2024

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 }

@olimart
Copy link
Author

olimart commented Mar 11, 2024

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

@olimart olimart closed this as completed Mar 11, 2024
@DustinFisher
Copy link

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.

@olimart
Copy link
Author

olimart commented Mar 24, 2024

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

@elpdev
Copy link

elpdev commented Apr 17, 2024

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

@collimarco
Copy link

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

@initseis
Copy link

This is a known issue in MacOS, @DustinFisher gave the solution.
In my case, I use: export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

@bjacobson26
Copy link

export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES fixes the issue for me as well.

Is that a safe permanent solution? seems like a hack.

@ChadMoran
Copy link

I'm on a M3 MacBook Pro and also noticed this started happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants