dejan/rails_panel

Stack level too deep after upgrading to 0.4.0

juanpedrojose opened this issue · 3 comments

After upgrading to 0.4.0 here is what I get on almost each request.
Sometimes the page loads normally. Browser independent (thought It could be a chrome-extensions related issue but no), same exception stack using wget/curl.

SystemStackError - stack level too deep:
  activesupport (4.2.5.1) lib/active_support/core_ext/object/json.rb:159:in `block in as_json'
  activesupport (4.2.5.1) lib/active_support/core_ext/object/json.rb:159:in `each'
  activesupport (4.2.5.1) lib/active_support/core_ext/object/json.rb:159:in `map'
  activesupport (4.2.5.1) lib/active_support/core_ext/object/json.rb:159:in `as_json'
...
  meta_request (0.4.0) lib/meta_request/event.rb:38:in `block in json_encodable'
  meta_request (0.4.0) lib/meta_request/event.rb:58:in `block in transform_hash'
  meta_request (0.4.0) lib/meta_request/event.rb:52:in `each'
  meta_request (0.4.0) lib/meta_request/event.rb:52:in `inject'
  meta_request (0.4.0) lib/meta_request/event.rb:52:in `transform_hash'
  meta_request (0.4.0) lib/meta_request/event.rb:36:in `json_encodable'
  meta_request (0.4.0) lib/meta_request/event.rb:13:in `initialize'
  meta_request (0.4.0) lib/meta_request/app_notifications.rb:33:in `new'
  meta_request (0.4.0) lib/meta_request/app_notifications.rb:33:in `block in <class:AppNotifications>'
  meta_request (0.4.0) lib/meta_request/app_notifications.rb:68:in `block in subscribe'
  meta_request (0.4.0) lib/meta_request/middlewares/app_request_handler.rb:13:in `call'
  meta_request (0.4.0) lib/meta_request/middlewares/meta_request_handler.rb:13:in `call'
  meta_request (0.4.0) lib/meta_request/middlewares/headers.rb:16:in `call'

Gemfile.lock

This error is still happening in Rails 6 RC 1

9244: from bin/rails:4:in `<main>'
9243: from bin/rails:4:in `require'
9242: from .rvm/gems/ruby-2.6.3/gems/railties-6.0.0.rc1/lib/rails/commands.rb:18:in `<top (required)>'
9241: from .rvm/gems/ruby-2.6.3/gems/railties-6.0.0.rc1/lib/rails/command.rb:46:in `invoke'
9240: from .rvm/gems/ruby-2.6.3/gems/railties-6.0.0.rc1/lib/rails/command/base.rb:65:in `perform'
9239: from .rvm/gems/ruby-2.6.3/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
9238: from .rvm/gems/ruby-2.6.3/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
9237: from .rvm/gems/ruby-2.6.3/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
 ... 9232 levels...
   4: from .rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc1/lib/active_support/core_ext/object/json.rb:172:in `as_json'
   3: from .rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc1/lib/active_support/core_ext/object/json.rb:172:in `map'
   2: from .rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc1/lib/active_support/core_ext/object/json.rb:172:in `each'
   1: from .rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc1/lib/active_support/core_ext/object/json.rb:172:in `block in as_json'

.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0.rc1/lib/active_support/core_ext/object/json.rb:172:in `dup': stack level too deep (SystemStackError)

Created a kind of a mokey patch to fix that, some time ago, feel free to use it.

https://github.com/alekseyl/rails_panel

add this to a Gemfile:


gem 'meta_request', git: 'https://github.com/alekseyl/rails_panel.git', glob: '/meta_request/meta_request.gemspec'

and introduce proper initialiser file into intialisers filder, with content similar to:

MetaRequest::Event.configure { |config|
  config[:NOT_JSON_ENCODABLE] << ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
}