Repository navigation
Closed
Description
I seem to have a persistent problem of jobs being worked but new jobs just get enqueued and workers stop pulling jobs to be worked. If I restart Solid Queue (rake solid_queue:start) then the jobs are immediately worked.
This happens with both recurring jobs as well as jobs that are "perform_later".
Starting the solid queue looks all good and there aren't any subsequent log items that indicate any issues.
cc@Mac-mini funstuff % rake solid_queue:start
[SolidQueue] Starting Dispatcher(pid=76984, hostname=Mac-mini.local, metadata={:polling_interval=>1, :batch_size=>500, :concurrency_maintenance_interval=>600, :recurring_schedule=>{:"Expire subs"=>{:schedule=>"every day at 00:01", :class_name=>"ExpireSubsJob", :arguments=>[]}, :send_notifications_subs_expired=>{:schedule=>"every day at 00:15", :class_name=>"SendSubsExpirationNotificationJob", :arguments=>[]}, :send_notifications_subs_expiring=>{:schedule=>"every day at 10:00am", :class_name=>"SendSubsExpiringIn7DaysEmailJob", :arguments=>[]}, :"Send new posts email"=>{:schedule=>"every weekday at 5:00, 8:00, 11:00, 13:00, 15:00", :class_name=>"SendNewPostsEmailJob", :arguments=>[]}, :"Identify posts"=>{:schedule=>"every hour at minute 5", :class_name=>"IdentifyPostsJob", :arguments=>[]}, :"Add posts to Profiles"=>{:schedule=>"every 10 minutes", :class_name=>"ProcessNewPostsToProfilesJob", :arguments=>[]}, :"Destroy incomplete Posts"=>{:schedule=>"every day at 7:00am", :class_name=>"CleanUpPostsJob", :arguments=>[]}}})
[SolidQueue] Starting Worker(pid=76985, hostname=Mac-mini.local, metadata={:polling_interval=>1, :queues=>"*", :thread_pool_size=>3})The only setting in my development.rb:
config.active_job.queue_adapter = :solid_queue
Solid Queue: 0.3.0
Rails: 7.1.3.2
Reacted by John McDowall, Wojciech Wnętrzak, Stillhart, Emil Kampp, Adam Miribyan, Christian, Šarūnas Navickas, Sjoerd Lagarde, Hugo van de Vliert, Creston Jamison and 8 more
Metadata
Metadata
Assignees
Labels
No labels
Activity
rosa commentedon Apr 10, 2024
Hey @carsoncole, sorry about that! Could you share a bit more about your DB setup? Also, could you try setting this:
And then starting
solid_queue:startagain? That might give us more clues about what's going on.ekampp commentedon Apr 10, 2024
I was seeing the same problem.
Disabling polling silence seems to trigger it to work properly.It turns out that it only works until a ruby file is changed.
carsoncole commentedon Apr 11, 2024
@rosa Overnight, jobs stopped executing again. I set
silence_polling = false. I've included the logs at the moment a job was created and enqueued. This is all running in development on my local Mac.In the Solid Queue console here is the output since I launched it, which I notice
undefined methodqueue_adapter_name' for nil:NilClass`...Also, I'm seeing 8 records in the table
solid_queue_ready_executions. Are these the jobs that are ready to be executed but aren't being executed?carsoncole commentedon Apr 11, 2024
Another recurring job just added. It's in the table
solid_queue_recurring_executionsand I see it as an entry insolid_queue_ready_executions, but in the log I only see the constant querySELECT "solid_queue_scheduled_executions"around the time the job is created.rosa commentedon Apr 11, 2024
Thanks for all this extra info! All the logs correspond to the dispatcher, it's as if the worker wasn't doing anything 🤔 The errors
aren't related to jobs not being processed; they correspond to recurring tasks whose job class might not be defined. I need to improve this to show a better error in that case and don't try to dispatch the task, but you can ignore the errors for now.
Could you share a bit more about your DB setup?
carsoncole commentedon Apr 11, 2024
database.yml
This may be relevant, I'm using Postgresql for Action Cable
cable.yml
carsoncole commentedon Apr 11, 2024
Another datapoint is that I have a
Jobclass in my app that represents jobs, ie. developer, bus driver etc.carsoncole commentedon Apr 11, 2024
So through my test case below, I can trigger the
undefined method `queue_adapter_name' for nil:NilClasswith an incorrectly named class.solid_queue.yml
Job file was named
testjob.rband the class name wasTestJobI've fixed that now and running again to see if that has anything to do with not working jobs.
carsoncole commentedon Apr 11, 2024
It does appear that the
SolidQueue::ReadyExecutionjust dies and does not give any indication of why. In my logs it is executing at its interval of 1 second, and then stops. Here in my logs you see it actually finds a record when doingBut then stops. Here is the full log and after the last entry for
SELECT solid_queue_ready_executionsit no longer makes the call.SjoerdL commentedon Apr 12, 2024
We noticed a similar issue in our setup. I couldn't reproduce it with a clean Rails app, so that makes it harder to debug. For us, we could reliably reproduce the issue in the following way:
=> This works fine. Solidqueue claims the job and executes it
=> we see a code reload in solidqueue
=> This doesn't work anymore. Solidqueue claims the job, but it doesn't get executed
We use a default configuration of solidqueue. I tried to dive into it a bit further. I found that solidqueue picked up the job and dispatches it to ActiveSupport. Here it gets stuck in executing
beforecallbacks. It gets very hairy here for me to understand what is going on, but it seemed that one of thebeforecallbacks tries to obtain a ShareLock, which is already held by a dead solidqueue worker. So thebeforecallback never acquires the lock, and therefore keeps waiting indefinetely.This specific thread was started by
launch_process_prune. I am thinking that a code reload somehow kills this worker thread, but I can't really figure out why or what should be done to prevent it.rosa commentedon Apr 12, 2024
@carsoncole thanks for all these extra details 🙏🏻 @SjoerdL, that's super helpful! I'll try to investigate a bit more today, and see if I can get to to bottom of this 🔍💪🏻
carsoncole commentedon Apr 12, 2024
I got the issue to show itself quickly by changing the threads to 1. To hide the issue longer, increase the number of threads.
[-]Enqueuing, but not Working unless restarted[/-][+]Workers eventually stop working[/+]carldr commentedon Apr 14, 2024
I'm experiencing a similar problem too, and is reliably caused in development mode by saving any Ruby file in my Rails project. As soon as I do, new jobs are picked up but never finish, and I have to ctrl+c solid queue and re-start it. If I don't save a file, Solid Queue will continue to work fine for hours.
I've not checked if they actually run or not before getting stuck, I came across this issue while investigating whether I'd setup something up incorrectly, but this seems very similar behaviour to what @SjoerdL is experiencing.
ekampp commentedon Apr 16, 2024
Hey, @rosa, thanks for digging into this one!
25 remaining items
searls commentedon Jul 31, 2024
👋 Came to the repo to open a similar issue, which I've been experiencing in local development since January. Until reading this, I was sort of at a loss as to why solid_queue workers would pick stuff up fine at startup and then eventually stop grabbing work—I hadn't considered that it might be due to (some consequence of) class reloading.
Unfortunately, I'm currently on the released version (0.3.4) and still experiencing this daily in development. I was just about to switch over to running inline or async locally to unblock myself. It's possible that I'm experiencing a different issue leading to the same outcome, but I don't feel well-equipped to debug it (any tips would be appreciated)
rosa commentedon Jul 31, 2024
Ouch, sorry to hear that @searls! I wonder if you could try running the branch in #269, not via the Puma plugin or anything, but just directly, and see if that changes anything 🤔
Do you think your issue happens also due to class reloading or could it be something else? What DB are you using?
searls commentedon Aug 1, 2024
Hi @rosa thank you for replying. I have been running off the branch in #269 since this morning and haven't seen it fail yet, but I'll keep you posted. I was almost sure it was failing again but it turns out that I was seeing a separate apparent issue
rosa commentedon Aug 1, 2024
Thanks a lot for letting me know, @searls 🙏 Huh, that issue is strange indeed 🤔
rosa commentedon Nov 14, 2024
I'm going to close this one as I haven't heard about it in a long time, and I trust it was fixed with #223.
jdblack commentedon Mar 12, 2025
rosa commentedon Mar 12, 2025
Hey @jdblack, that seems like a different issue... 🤔 Unfortunately the logs alone don't offer a lot of clues. Did your computer go to sleep or something in between that?
jdblack commentedon Mar 12, 2025
Yes. I think that is it! Thanks! I've hidden my comment as outdated.
kirley commentedon Oct 25, 2025
I just upgraded from 1.2.1 to 1.2.2 and I think this bug is back. When I downgrade to 1.2.1 the worker persists through code changes in development, but with 1.2.2 the workers stop processing jobs after a file is saved in the Rails app.
justindoody commentedon Oct 29, 2025
In case anyone else stumbles upon this thread while debugging instead of the other like I did it appears resolved in
1.2.3per #672 (and confirmed by my own testing of1.2.3)cilim commentedon Jan 20, 2026
Continuing suggestions for anyone that stumbles upon this bug. Had the same issue. Our solution was increasing the container RAM size from 512MB to 1024MB.
andyjeffries commentedon Jan 20, 2026
Has that definitely fixed it @cilim ? This was happening on my machine with 64GB of RAM and not in a container. It also only happened in development mode. Anyway, might want to check your side that it's definitely fixed and not just delayed.
rosa commentedon Jan 20, 2026
Huh, yes, this bug was reintroduced in 1.2.2, then fixed in 1.2.3. It was something happening in development only, and should be fixed from version 1.2.3.
cilim commentedon Jan 20, 2026
Thanks @andyjeffries! After a week of testing solid_queue, I woke up and found the container in zombie mode every morning. After deploying the RAM increase yesterday, the container was working ok this morning. But yeah, maybe the issue is just delayed...I'll keep an eye out.