Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6952541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:21:45+00:00 2026-05-27T14:21:45+00:00

I have a simple stack with Ruby on Rails and resque . I enqueue

  • 0

I have a simple stack with Ruby on Rails and resque. I enqueue jobs in a normal way and I have a pool of workers performing. Nothing crazy.

My problem is that if I leave the workers running for long enought they will stop to have visibility on the app’s models, and every call to such a method will result in an undefined_method.

This is very weird since it could be working perfectly for days and then suddenly it starts failing. Restarting the worker fixes the problem, but it usually come back after a while.

I have no clue what could be going on, so any pointers would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:21:46+00:00Added an answer on May 27, 2026 at 2:21 pm

    Resque workers fork new processes to do the work. It’s possible that the classes for your models are not loaded in the forked child process. It’s also possible that there is a namespace collision because of the order that classes are loaded.

    If you are changing class files in development without restarting your resque workers, I suspect it’s not reloading your classes correctly.

    To make sure that your classes are loaded pre-fork, reference the classes in the resque setup task. The classes that are loaded pre-fork will be copied to the child process. Below, I put them in an array to force them to load. This is also faster, since each child process will already have the classes loaded. Also you should re-establish your ActiveRecord connection in an after_fork block if you’re using AR.

    lib/tasks/resque.rake:

    namespace :resque do
      task :setup => :environment do
        [User, Monkey, Banana] # force these classes to load
    
        Resque.after_fork { ActiveRecord::Base.establish_connection }
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple ruby on rails project that I'm trying to use a
I have simple issue setting a two-way databinding of a checkbox in Silverlight 3.0.
am a newbie in ruby on rails and am stuck with a simple problem
Let's suppose I have a very simple Ruby program: require 'rubygems' require 'ruby-debug' x
I'm trying to write a simple stock check program, and I have a Table
A little stuck here. I have a simple question I guess. Given the following
I am stuck with something quite simple but really annoying: I have an xml
I have simple regex \.*\ for me its says select everything between and ,
I have simple win service, that executes few tasks periodically. How should I pass
i have simple regular expression: ^123$ Matches are for example 123 1234 etc. How

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.