Sergio Campamá
2013-Jul-27 21:23 UTC
ActiveSupport::JSON::Encoding SystemStackError: stack level too deep
Hello, Is there anyone here who knows how ActiveSupport::JSON::Encoding works? I have been trying to check issue https://github.com/rails/rails/issues/11460, but I am getting confused in all the times the encoder goes through the values. I think that it is too convoluted to what it intends to do, with the use_options flags and the encode_json and as_json methods in the core classes. Is someone here familiarized with that code to give me some help in fixing this issue? I have created a test that breaks with a SystemStackError: def test_exception_raised_when_encoding_circular_reference_in_hash_inside_object a = {} b = Foo.new(a, nil) a["a"] = b assert_raise(ActiveSupport::JSON::Encoding::CircularReferenceError) { ActiveSupport::JSON.encode(a) } end Best regards, -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/groups/opt_out.
Godfrey Chan
2013-Jul-28 03:50 UTC
Re: ActiveSupport::JSON::Encoding SystemStackError: stack level too deep
I''m working on a PR in the same area (AS::JSON::Encoding). I allocated some time to work on this on Tuesday at our local ruby hack night. If your still need help by then we can probably look into this together. Chat on IRC? — Sent from Mailbox for iPhone On Sat, Jul 27, 2013 at 2:23 PM, Sergio Campamá <sergiocampama@gmail.com> wrote:> Hello, > Is there anyone here who knows how ActiveSupport::JSON::Encoding works? I > have been trying to check > issue https://github.com/rails/rails/issues/11460, but I am getting > confused in all the times the encoder goes through the values. I think that > it is too convoluted to what it intends to do, with the use_options flags > and the encode_json and as_json methods in the core classes. Is someone > here familiarized with that code to give me some help in fixing this issue? > I have created a test that breaks with a SystemStackError: > def > test_exception_raised_when_encoding_circular_reference_in_hash_inside_object > a = {} > b = Foo.new(a, nil) > a["a"] = b > > assert_raise(ActiveSupport::JSON::Encoding::CircularReferenceError) { > ActiveSupport::JSON.encode(a) } > end > Best regards, > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. > To post to this group, send email to rubyonrails-core@googlegroups.com. > Visit this group at http://groups.google.com/group/rubyonrails-core. > For more options, visit https://groups.google.com/groups/opt_out.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/groups/opt_out.
Sergio Campamá
2013-Jul-28 13:42 UTC
Re: ActiveSupport::JSON::Encoding SystemStackError: stack level too deep
That would be great. At what time is the hack? I''m at GMT -4 (Chile) On Sat, Jul 27, 2013 at 11:50 PM, Godfrey Chan <godfreykfc@gmail.com> wrote:> I''m working on a PR in the same area (AS::JSON::Encoding). I allocated > some time to work on this on Tuesday at our local ruby hack night. If your > still need help by then we can probably look into this together. Chat on > IRC? > — > Sent from Mailbox <https://www.dropbox.com/mailbox> for iPhone > > > On Sat, Jul 27, 2013 at 2:23 PM, Sergio Campamá <sergiocampama@gmail.com>wrote: > >> Hello, >> >> Is there anyone here who knows how ActiveSupport::JSON::Encoding works? I >> have been trying to check issue >> https://github.com/rails/rails/issues/11460, but I am getting confused >> in all the times the encoder goes through the values. I think that it is >> too convoluted to what it intends to do, with the use_options flags and the >> encode_json and as_json methods in the core classes. Is someone here >> familiarized with that code to give me some help in fixing this issue? I >> have created a test that breaks with a SystemStackError: >> >> def >> test_exception_raised_when_encoding_circular_reference_in_hash_inside_object >> a = {} >> b = Foo.new(a, nil) >> a["a"] = b >> >> assert_raise(ActiveSupport::JSON::Encoding::CircularReferenceError) { >> ActiveSupport::JSON.encode(a) } >> end >> >> Best regards, >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Core" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to rubyonrails-core+unsubscribe@googlegroups.com. >> To post to this group, send email to rubyonrails-core@googlegroups.com. >> Visit this group at http://groups.google.com/group/rubyonrails-core. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-core+unsubscribe@googlegroups.com. > To post to this group, send email to rubyonrails-core@googlegroups.com. > Visit this group at http://groups.google.com/group/rubyonrails-core. > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/groups/opt_out.