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 8323755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:49:13+00:00 2026-06-08T23:49:13+00:00

I’m trying to debug an issue that’s started coming up recently in my Rails

  • 0

I’m trying to debug an issue that’s started coming up recently in my Rails (3.0.9) app, in which instances of the app have to be restarted (not redeployed) when a non-breaking migration is performed on the database. This did not used to happen, and I can’t find a reason it should have started recently.

My production environment has a few servers, each of which is using forked Unicorn instances, all sharing a single MySQL instance. Each instance is using a connection pool of 1. I also have one server that’s used as a final staging environment to test against live data, after testing against a staging database.

In the past, we’ve been able to run migrations on the production DB without redeploying or even restarting the production Unicorn servers as long as they were migrations that the old code never needed to see. For example, adding a new, optional field to an existing table — the code deployed to the staging server would write data to it, but the existing servers could blissfully ignore it and continue to use the DB the same way it had been until we’re ready to push the new code to production.

Recently, though, we’ve been seeing an exception being thrown by production servers after running the migration, but only when it tries to insert a new row into the modified table. All other parts of the app, and all other tables, are unaffected, but as soon as there’s an insert, we get this:

NoMethodError: undefined method `name' for nil:NilClass

[GEM_ROOT]/gems/arel-2.0.10/lib/arel/visitors/to_sql.rb:56:in `visit_Arel_Nodes_InsertStatement'
[GEM_ROOT]/gems/arel-2.0.10/lib/arel/visitors/to_sql.rb:55:in `map'
[GEM_ROOT]/gems/arel-2.0.10/lib/arel/visitors/to_sql.rb:55:in `visit_Arel_Nodes_InsertStatement'
[GEM_ROOT]/gems/arel-2.0.10/lib/arel/visitors/visitor.rb:15:in `send'
[GEM_ROOT]/gems/arel-2.0.10/lib/arel/visitors/visitor.rb:15:in `visit'
[GEM_ROOT]/gems/arel-2.0.10/lib/arel/visitors/visitor.rb:5:in `accept'
[GEM_ROOT]/gems/arel-2.0.10/lib/arel/visitors/to_sql.rb:18:in `accept'
[GEM_ROOT]/bundler/gems/rails-83fb5552b6ab/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:111:in `with_connection'
[GEM_ROOT]/gems/arel-2.0.10/lib/arel/visitors/to_sql.rb:16:in `accept'
[GEM_ROOT]/gems/arel-2.0.10/lib/arel/tree_manager.rb:20:in `to_sql'
[GEM_ROOT]/gems/arel-2.0.10/lib/arel/select_manager.rb:217:in `insert'

The issue goes away if we then restart the production servers, even though they’re still running the old code. So it seems that something gets corrupted in the connection when the table is modified, even though the app, if it hadn’t hit this error, would be fine continuing to do what is was doing before the migration.

I did some digging into ActiveRecord/ARel, but the most I can do is theorize that at some point the cached model of this table loses any knoweledge of which columns it has, but I can’t see why it would do that or why this would be happening all of a sudden.

  • 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-06-08T23:49:15+00:00Added an answer on June 8, 2026 at 11:49 pm

    I’m a coworker of Jon’s, going to answer this for posterity.

    The problem was a consequence of the caching in https://github.com/rails/rails/blob/v3.0.9/activerecord/lib/active_record/base.rb; essentially @columns and @arel_table for certain model classes were out of sync because the latter was cached during app initialization and thus inherited from the master Unicorn by any new worker.

    We fixed it by preventing calls to any model’s ::scoped or ::unscoped during initialization where we could, and calling ::reset_column_information afterwards where we couldn’t.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have a text area in my form which accepts all possible characters from
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post
I am trying to loop through a bunch of documents I have to put
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

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.