collectiveidea / delayed_job

Database based asynchronous priority queue system -- Extracted from Shopify
http://groups.google.com/group/delayed_job
MIT License
4.81k stars 955 forks source link

Upgrading from Rails 5.2.4 to 6.1.6 with Delayed Job - Job's not being picked up #1171

Open bh8ur8js opened 2 years ago

bh8ur8js commented 2 years ago

Working config

ruby 2.6.2

rails 5.2.4

delayed_job 4.1.8

#config/environments/development.rb

config.active_job.queue_adapter = :delayed_job
config.active_job.queue_name_prefix = "ukcil_#{Rails.env}"
#config/application.rb
config.active_job.queue_adapter = :delayed_job

#Started with

bin/delayed_job -n 1 start
#Environment vairables are

RAILS_ENV=development
QUEUES=*
#config/initializers/delayed_job.rb

Delayed::Worker.queue_attributes = {
  mailers_h: {priority: 0},
  mailers_l: {priority: 10},
  general_h: { priority: 20 },
  general_l: { priority: 30 }
}

After upgrading to

Ruby 2.7.2 Rails 6.1.6 delayed_job 4.1.10

everything is working except for delayed_job .

Jobs are being queued correctly, appearing delayed_job_web front end view, as before

The delayed_job process is running, as per activity monitor, but the jobs are not being picked up or process.

I just can't see what's changed here. It's not showing any errors.

I thought it would be something esoteric that was causing it. I think it might be, I can find no documentation about a similar problem. Any help with be gratefully received.

bh8ur8js commented 2 years ago

One last thing, if I open a Rails Console

q = Delayed::Worker.new(quiet: false)
q.start

It works. The polling starts and works off the queue.

However when running as a process

bundle exec bin/delayed_job --queues=*  run

It doesn't seem to starting the Worker Object

joelcahalan commented 2 years ago

I am having this issue also. Did you find a solution?

bh8ur8js commented 2 years ago

I have not. It's very frustrating.

It's seem so random. We can test all the mechanisms are working. It's just not starting.

Are you using macOS or Linux ? Something has changed in the delayed _job executable.

I can't find anything.

joelcahalan commented 2 years ago

I have no problem on Rails 6.0 but when I try using Rails 6.1 I get the behavior you describe. I am using macos. I don't have time right now to debug.

bh8ur8js commented 2 years ago

I would love to but it's beyond my skill level.

johngronow commented 1 year ago

I am seeing the exact same behaviour.

Running Ruby 3.0.4. Rails 6.0.5.1 and Delayed Job 4.1.10, everything works perfectly.

Upgrade to Rails 6.1.6.1 with the same versions of Ruby and Delayed Job and workers no longer pick up jobs, except when run from the console.

Can anyone suggest a fix?

Update: This is actually working in production, so my problem is only in my development environment. The difference is that my development machine is a Mac (macOS Monterey 12.4) whereas production is deployed on Ubuntu (20.04 LTS).

bh8ur8js commented 1 year ago

@johngronow That's positive. I had a hunch or rather I was hoping that this would be the case with it working in production.

martinstreicher commented 1 year ago

Did anyone find the cause of this?

bh8ur8js commented 1 year ago

Ultimately this is issue is specific to macOS. Upgrading to other version sorts it and in production it’s Linux where the issue doesn’t happen. It would be interesting to know why it is happening but the benefit would be low.

On Wed, 8 Feb 2023 at 18:47, Martin Streicher @.***> wrote:

Did anyone find the cause of this?

— Reply to this email directly, view it on GitHub https://github.com/collectiveidea/delayed_job/issues/1171#issuecomment-1423083713, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFJFX77RFUGI3GVZF3ZZHSDWWPS55ANCNFSM5WT532UA . You are receiving this because you authored the thread.Message ID: @.***>

--

Jagdeep Bhaura | CEO @.*** | +44 333 050 8000 | +44 7973 786164 http://mypeoplebiz.com/ https://www.facebook.com/mypeoplebiz/ https://twitter.com/mypeoplebiz https://twitter.com/mypeoplebiz CONFIDENTIALITY NOTE: The information contained in this transmission is privileged and confidential information intended only for the use of the individual or entity named above. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this transmission in error, do not read it. Please immediately reply to the sender that you have received this communication in error and then delete it. Thank you.

martinstreicher commented 1 year ago

@bh8ur8js When you say "Upgrading to other version", are you talking about a newer Delayed Job? We are also seeing it in Ubuntu.

dgm commented 4 months ago

I'm seeing this with Rails 7.1, running development mode on OS X. delayed_job run just sits there, I don't see any indication that it's even polling the database for jobs.