-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERROR SystemStackError: stack level too deep in active_support_encoder.rb:17 #112
Comments
Can I see the full backtrace? |
Sadly this is the only trace that is printed in the log. Here is the complete log of a single request after enabling rack-mini-profiler gem and its initializer: As mentioned earlier, the lat few lines does not appear if I remove the rack-mini-profiler gem and its initializer code. I am not really sure why the trace is incomplete. Also the trace does not have any files related to your gem. ➜ duggout (master) rails server -p 3113 ✭ ✈
=> Booting WEBrick
=> Rails 4.1.4 application starting in development on http://0.0.0.0:3113
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
/Users/leninraj/.rvm/gems/ruby-2.1.2/gems/merit-2.1.2/lib/merit.rb:83: warning: already initialized constant Merit::AppBadgeRules
/Users/leninraj/.rvm/gems/ruby-2.1.2/gems/merit-2.1.2/lib/merit.rb:83: warning: previous definition of AppBadgeRules was here
/Users/leninraj/.rvm/gems/ruby-2.1.2/gems/merit-2.1.2/lib/merit.rb:84: warning: already initialized constant Merit::AppPointRules
/Users/leninraj/.rvm/gems/ruby-2.1.2/gems/merit-2.1.2/lib/merit.rb:84: warning: previous definition of AppPointRules was here
[2014-12-02 18:03:04] INFO WEBrick 1.3.1
[2014-12-02 18:03:04] INFO ruby 2.1.2 (2014-05-08) [x86_64-darwin13.0]
[2014-12-02 18:03:04] INFO WEBrick::HTTPServer#start: pid=66772 port=3113
Started GET "/" for 127.0.0.1 at 2014-12-02 18:03:05 +0530
ActiveRecord::SchemaMigration Load (0.7ms) SELECT "schema_migrations".* FROM "schema_migrations"
Processing by IndexController#index as HTML
Lookup Load (1.5ms) SELECT "lookups".* FROM "lookups" WHERE "lookups"."lkp_type" = 'homepage_items' AND (name_1 = 'image_main') ORDER BY "lookups"."id" ASC LIMIT 1
Lookup Load (0.9ms) SELECT "lookups".* FROM "lookups" WHERE "lookups"."lkp_type" = 'homepage_items' AND (name_1 = 'side_1') ORDER BY "lookups"."id" ASC LIMIT 1
Lookup Load (0.8ms) SELECT "lookups".* FROM "lookups" WHERE "lookups"."lkp_type" = 'homepage_items' AND (name_1 = 'list_main') ORDER BY "lookups"."id" ASC LIMIT 1
Page Load (0.9ms) SELECT "pages".* FROM "pages" WHERE "pages"."url_code" = 'silly-point' LIMIT 1
Page Load (1.0ms) SELECT "pages".* FROM "pages" WHERE "pages"."url_code" = 'news' LIMIT 1
Post Load (1.4ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" IN (5, 6, 7)
Category Load (1.3ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" IN (15, 1, 10)
Post Load (0.8ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = $1 LIMIT 1 [["id", 6]]
Category Load (1.2ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" IN (1)
Post Load (1.1ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" IN (1, 2, 3, 4, 5, 6, 7)
Category Load (1.2ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" IN (17, 1, 10, 15)
Post Load (1.6ms) SELECT "posts".* FROM "posts" INNER JOIN "posties" ON "posts"."id" = "posties"."post_id" WHERE "posties"."target_id" = $1 AND "posties"."target_type" = $2 ORDER BY created_at DESC LIMIT 1 [["target_id", 3], ["target_type", "Page"]]
Post Load (1.6ms) SELECT "posts".* FROM "posts" INNER JOIN "posties" ON "posts"."id" = "posties"."post_id" WHERE "posties"."target_id" = $1 AND "posties"."target_type" = $2 ORDER BY created_at DESC LIMIT 10 [["target_id", 3], ["target_type", "Page"]]
Category Load (5.7ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" = $1 LIMIT 1 [["id", 1]]
Category Load (1.9ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" = $1 LIMIT 1 [["id", 10]]
CACHE (0.0ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" = $1 LIMIT 1 [["id", 1]]
Post Load (1.1ms) SELECT "posts".* FROM "posts" INNER JOIN "posties" ON "posts"."id" = "posties"."post_id" WHERE "posties"."target_id" = $1 AND "posties"."target_type" = $2 ORDER BY created_at DESC LIMIT 1 [["target_id", 2], ["target_type", "Page"]]
Post Load (0.8ms) SELECT "posts".* FROM "posts" INNER JOIN "posties" ON "posts"."id" = "posties"."post_id" WHERE "posties"."target_id" = $1 AND "posties"."target_type" = $2 ORDER BY created_at DESC LIMIT 10 [["target_id", 2], ["target_type", "Page"]]
Category Load (0.9ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" = $1 LIMIT 1 [["id", 3]]
Category Load (0.9ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" = $1 LIMIT 1 [["id", 15]]
Rendered partials/opencricket/_open_cricket_recent.html.erb (1.0ms)
Rendered index/index.html.erb within layouts/application (345.6ms)
Rendered partials/opencricket/_search.html.erb (0.8ms)
Lookup Load (1.5ms) SELECT "lookups".* FROM "lookups" WHERE "lookups"."lkp_type" = 'homepage_items' AND (name_1 = 'series_list') ORDER BY "lookups"."id" ASC LIMIT 1
Series Load (1.4ms) SELECT "series".* FROM "series" WHERE "series"."id" IN (1, 2, 3, 8, 9, 10)
Post Load (1.4ms) SELECT "posts".* FROM "posts" WHERE (post_type = 4) ORDER BY created_at DESC LIMIT 5
Category Load (1.0ms) SELECT "categories".* FROM "categories" WHERE "categories"."id" = $1 LIMIT 1 [["id", 13]]
Rendered layouts/_menu.html.erb (35.7ms)
Rendered layouts/_header.html.erb (43.3ms)
Rendered layouts/_footer.html.erb (1.1ms)
Completed 200 OK in 1132ms (Views: 1027.8ms | ActiveRecord: 53.9ms)
Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:06 +0530
Started GET "/assets/font-awesome.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:06 +0530
Started GET "/assets/jquery-ui/datepicker.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:06 +0530
Started GET "/assets/jquery-ui/core.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:06 +0530
Started GET "/assets/select2.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:06 +0530
Started GET "/assets/jquery-ui/theme.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:06 +0530
Started GET "/assets/select2-bootstrap.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:06 +0530
Started GET "/assets/parsley.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:06 +0530
Started GET "/assets/nv.d3.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:06 +0530
Started GET "/assets/desktop/960.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:06 +0530
Started GET "/assets/desktop/base.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:06 +0530
Started GET "/assets/desktop/flexslider.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:06 +0530
Started GET "/assets/desktop/fontello.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:06 +0530
Started GET "/assets/desktop/forms.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:06 +0530
Started GET "/assets/desktop/grounds.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/desktop/header.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/desktop/index.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/desktop/matches.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/desktop/megamenu.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/desktop/mixins.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/desktop/players.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/desktop/posts.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/desktop/scaffold.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/desktop/series.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/desktop/style.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/desktop/superfish.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/desktop/teams.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/desktop/typeahead-override.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/desktop/typeaheadjs.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/desktop/ui.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/desktop/variables.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/jquery.turbolinks.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/turbolinks.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/typeahead.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/jquery-ui/core.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/jquery-ui/widget.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/jquery-ui/accordion.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/jquery-ui/tabs.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/jquery-ui/position.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/jquery-ui/tooltip.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/jquery-ui/datepicker.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/tinymce/preinit.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/tinymce-jquery.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/select2.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/js-routes.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/parsley.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/underscore.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/backbone.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/d3.min.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/nv.d3.min.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/duggout.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/templates/commentaries/addCommentary.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/templates/commentaries/index.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/templates/commentaries/item.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/models/commentary.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/collections/commentaries.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/views/commentaries/commentaries_index.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/views/commentaries/commentaries_item.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/views/commentaries/commentaries_new.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:07 +0530
Started GET "/assets/routers/commentaries_router.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/jquery-ui/button.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/jquery-ui/mouse.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/jquery-ui/draggable.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/jquery-ui/resizable.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/jquery-ui/dialog.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/jquery-ui/sortable.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/active_admin/base.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/active_admin/lib/batch_actions.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/active_admin/lib/checkbox-toggler.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/active_admin/lib/dropdown-menu.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/active_admin/lib/flash.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/active_admin/lib/has_many.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/active_admin/lib/modal_dialog.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/active_admin/lib/popover.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/active_admin/lib/table-checkbox-toggler.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/active_admin/ext/jquery-ui.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/active_admin/ext/jquery.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/active_admin/application.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/active_admin.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/carouFredSel.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/customM.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/facebook_sdk.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/flexslider.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/global.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/grounds.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/index.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/jquery.easing.1.3.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/matches.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/mobilemenu.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/mypassion.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/posts.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/series.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/superfish.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/teams.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/__meta_request/ba6f2ffb-eba2-405b-a815-f75213cde14c.json" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/479.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/duggout_helmet_logo.png" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/1000.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/767.css?body=1" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/fontawesome-webfont.woff" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/futura_today_demibold.ttf" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/futura_today_bold.ttf" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
Started GET "/assets/slider-nav.png" for 127.0.0.1 at 2014-12-02 18:03:08 +0530
[2014-12-02 18:03:10] ERROR SystemStackError: stack level too deep
/Users/leninraj/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/set.rb:81
[2014-12-02 18:03:10] ERROR SystemStackError: stack level too deep
/Users/leninraj/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/set.rb:81
[2014-12-02 18:03:10] ERROR SystemStackError: stack level too deep
/Users/leninraj/.rvm/gems/ruby-2.1.2/bundler/gems/activesupport-json_encoder-072ab26faeaa/lib/active_support/json/encoding/active_support_encoder.rb:17 |
This is what I'm getting.
|
+1. The ruby process hangs in what seems like an infinite loop. and the POST for result never returns, making both the server and the gem unusable.
This issue is with the fact that I am using OJ and oj_mimic_json and OJ doesn't handle circular dependency. |
Ruby's JSON serialization doesn't handle circular references, which is why another gem I've worked on included their own implementation. Though in this situation we control all of the data, so we should be able to get rid of the circular reference instead of resorting to that. |
I fixed it naively by monkey patching
|
@SamSaffron I put together solutions from @emaillenin @zapo and I'm able to finally use Oj and Miniprofiler together. Thank you guys! Gemfile gem 'rack-mini-profiler', group: 'development', require: false config/initializers/miniprofiler.rb if Rails.env.development?
require 'rack-mini-profiler'
# Fix circular ref conflict with Oj.mimic_json
module Rack
class MiniProfiler
module TimerStruct
class Base
def as_json
@attributes
end
end
end
end
end
# Initialization is skipped so trigger it
Rack::MiniProfilerRails.initialize!(Rails.application)
end |
So is the thought to add this monkey patch directly to the source? Or to put in a patch to oj? Or modify our data structure to remove the circular dependency? |
Bump. I would lean toward removing the circular dependency. |
The circular dependency was removed in #250 and is fixed on master. This issue can probably be closed. |
When I add,
in my Gemfile and
in my initializer, I get the following trace at the end of my Rails log for all requests and I do not see the Mini Profiler. App works fine though.
When I remove the gem and the initializer, I do not see this error in the trace. This is the code around active_support_encoder.rb:17
Here is my Gemfile:
What could be the issue? How do I get mini profiler to work?
The text was updated successfully, but these errors were encountered: