departurerb / departure

Percona's pt-online-schema-change runner for ActiveRecord migrations.
Other
140 stars 53 forks source link

SystemStackError: stack level too deep (Module#prepend) #89

Open plantoeat opened 1 year ago

plantoeat commented 1 year ago

We are getting a SystemStackError: stack level too deep with the strong_migrations gem installed.

/Users/me/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/bundler/gems/departure-b7187bcf0061/lib/departure/migration.rb:60:in `migrate'
/Users/me/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/strong_migrations-1.4.4/lib/strong_migrations/migration.rb:5:in `migrate'
/Users/me/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/bundler/gems/departure-b7187bcf0061/lib/departure/migration.rb:60:in `migrate'
/Users/me/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/strong_migrations-1.4.4/lib/strong_migrations/migration.rb:5:in `migrate'
/Users/me/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/bundler/gems/departure-b7187bcf0061/lib/departure/migration.rb:60:in `migrate'
/Users/me/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/strong_migrations-1.4.4/lib/strong_migrations/migration.rb:5:in `migrate'
/Users/me/.rbenv/versions/2.6.8/lib/ruby/gems/2.6.0/gems/activerecord-6.1.7.3/lib/active_record/migration.rb:1037:in `migrate'
      # departure/migration.rb:21
      alias_method :active_record_migrate, :migrate
      remove_method :migrate
    def migrate(direction)
      if uses_departure?
        departure_migrate(direction)
      else
        reconnect_without_percona
        active_record_migrate(direction) # departure/migration.rb:60
      end
    end

And I received this message from the creator of strong_migrations. "I looked into this for another two gems a while back, and the (older) alias_method pattern isn't compatible with Module#prepend. Updating departure to use Module#prepend should fix it."