1

i am having a problem with a project ruby 2.5.3 rails 5.0.7.2, its working fine in ubuntu, but in mac osx monterey m1 with intel virtualized via rosetta (everything installed for intel arch, brew, ruby, packages...cant install in arm arch due to some gems compatibility) is showing the typical recursive error of stack level too deep in almost every view (while its not happening in ubuntu, same config) what can be the reason? tell me what type of logs do you need to try to solve it, because the simplests trace is just this.

Trace of the action and error

Started GET "/products" for 127.0.0.1 at 2021-12-25 12:05:17 +0100
Processing by ProductsController#index as HTML
  User Load (1.4ms)  SELECT  `users`.* FROM `users` WHERE `users`.`id` = 12015 ORDER BY `users`.`id` ASC LIMIT 1
   (1.9ms)  SELECT DISTINCT COUNT(DISTINCT `messages`.`id`) FROM `messages` INNER JOIN `messages_users` ON `messages`.`id` = `messages_users`.`message_id` WHERE `messages_users`.`user_id` = 12015 AND `messages_users`.`read` = 0
   (10.8ms)  SELECT DISTINCT COUNT(DISTINCT `notifications`.`id`) FROM `notifications` INNER JOIN `notifications_users` ON `notifications`.`id` = `notifications_users`.`notification_id` WHERE `notifications_users`.`user_id` = 12015 AND `notifications_users`.`read` = 0
  Role Load (4.1ms)  SELECT `roles`.* FROM `roles` INNER JOIN `users_roles` ON `roles`.`id` = `users_roles`.`role_id` WHERE `users_roles`.`user_id` = 12015 AND (((roles.name = 'admin') AND (roles.resource_type IS NULL) AND (roles.resource_id IS NULL)))
  Role Load (0.8ms)  SELECT `roles`.* FROM `roles` INNER JOIN `users_roles` ON `roles`.`id` = `users_roles`.`role_id` WHERE `users_roles`.`user_id` = 12015 AND (((roles.name = 'god') AND (roles.resource_type IS NULL) AND (roles.resource_id IS NULL)))
  Product Load (1.6ms)  SELECT  `products`.* FROM `products` ORDER BY `products`.`id` ASC LIMIT 1
  CACHE (0.0ms)  SELECT `roles`.* FROM `roles` INNER JOIN `users_roles` ON `roles`.`id` = `users_roles`.`role_id` WHERE `users_roles`.`user_id` = 12015 AND (((roles.name = 'god') AND (roles.resource_type IS NULL) AND (roles.resource_id IS NULL)))  [["user_id", 12015]]
  Rendering products/index.html.slim within layouts/application
  Rendered products/_search.html.slim (11.4ms)
  Product Load (1.3ms)  SELECT  `products`.* FROM `products` LIMIT 6 OFFSET 0
  ProductSetting Load (26.5ms)  SELECT  `product_settings`.* FROM `product_settings` WHERE `product_settings`.`product_id` = 1 LIMIT 1
  FactoryField Load (1.4ms)  SELECT  `factory_fields`.* FROM `factory_fields` WHERE `factory_fields`.`product_id` = 1 LIMIT 1
  Rendered products/_row.html.slim (333.2ms)
  ProductSetting Load (2.4ms)  SELECT  `product_settings`.* FROM `product_settings` WHERE `product_settings`.`product_id` = 8 LIMIT 1
  FactoryField Load (0.9ms)  SELECT  `factory_fields`.* FROM `factory_fields` WHERE `factory_fields`.`product_id` = 8 LIMIT 1
  Rendered products/_row.html.slim (29.7ms)
  Rendered products/_table.html.slim (373.7ms)
  Rendered products/index.html.slim within layouts/application (404.8ms)
Completed 500 Internal Server Error in 500ms (ActiveRecord: 75.3ms)


  
SystemStackError (stack level too deep):
  
app/views/products/_row.html.slim:50:in `_app_views_products__row_html_slim___2233824361697382113_70278070863220'
app/views/products/_table.html.slim:5:in `block in _app_views_products__table_html_slim___1455904629476273201_70278148792920'
app/views/products/_table.html.slim:4:in `_app_views_products__table_html_slim___1455904629476273201_70278148792920'
app/views/products/index.html.slim:16:in `_app_views_products_index_html_slim__1790897122966062520_70278149402760'
  Rendering /Users/joker/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout
  Rendering /Users/joker/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
  Rendered /Users/joker/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (18.7ms)
  Rendering /Users/joker/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
  Rendered /Users/joker/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (5.1ms)
  Rendering /Users/joker/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
  Rendered /Users/joker/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (0.9ms)
  Rendered /Users/joker/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (130.2ms)

row view (the error come fron product.factory_field) if i remove .factory_field and just leaves product, it works, but the same line with same code, ddbb, etc is working in ubuntu :/

- if actions.include? :factory_fields
            td
              = link_to factory_field_path(product.factory_field), title: t('actions.manage_x', x: title(:factory_fields)) do
                i.fa.fa-building.action-icon

table view

- products.each do |product|
      div[id="product-#{product.id}"]= render partial: 'products/row', locals: {product: product, actions: actions, columns: columns }

what products contains from index action controller

set_q_and_list_ransack ProductDomain.products_for_user( current_user, ProductDomain.products( @global[:parent] ) ), :products, 6, :q

product model with factory_field relation

has_one :factory_field, dependent: :destroy, inverse_of: :product

factory field model with product relation

belongs_to :product, inverse_of: :factory_field, required: true
validates :product_id, presence: true
validates_uniqueness_of :product_id, message:  I18n.t('errors.duplicate_relation')
uko
  • 11
  • 2
  • Please edit your question and add the full stacktrace (possibly edit out repeating segments). Also, please add the source code of relevant files in the stack trace. In general, the high-level behavior of Ruby and Rails is not dependent on the architecture. It would thus be rather surprising if you have found a bug here. It's more likely that there are some differences between your Mac and Ubuntu environments (different code, different database content, ...) that cause the infinite recursion in your own code. – Holger Just Dec 23 '21 at 18:39
  • @HolgerJust edited with trace and its info, if i need to give some more, tell me. thanks! – uko Dec 25 '21 at 11:24

0 Answers0