SystemStackError: stack level too deep #134

Closed
lobo-tuerto opened this Issue Apr 17, 2015 · 3 comments

Comments

Projects
None yet
3 participants
@lobo-tuerto

I just switched from Mongoid (MongoDB) to NoBrainer (RethinkDB) for a new project.

The migration was mostly painless. But I have found an intermitent error that says something along the lines:

rake test
Run options: --seed 23337

# Running:

*****E***

Fabulous run in 0.366772s, 24.5384 runs/s, 40.8973 assertions/s.

1) Error:
  API::RecetasController#test_0001_debe regresar la lista de recetas:
SystemStackError: stack level too deep
app/controllers/api/recetas_controller.rb:4:in `index'
    test/controllers/api/recetas_controller_test.rb:11:in `block (2 levels) in <top (required)>'

9 runs, 15 assertions, 0 failures, 1 errors, 0 skips

The code in question is this:

class API::RecetasController < ApplicationController
  def index
    @recetas = Receta.all
    respond_with( @recetas )
  end
  ...
end

I'm kind of new to the NoSQL party, maybe I'm doing it wrong or something, but I figured I could ask here for pointers. What's surprising to me is that sometimes the test runs without problem, and sometimes it breaks.

If I do a rake nobrainer:reset it stops breaking. Then what's the error about?
I have found that it happens sometimes when Receta.all.to_json is called.

I guess the right way to do it is with Receta.all.to_a before a .to_json is called?

Do you have any advice on this? Or could you shed some light on why is this happening?

@ajselvig

This comment has been minimized.

Show comment
Hide comment
@ajselvig

ajselvig Apr 18, 2015

Contributor

Try Receta.all.entries
On Apr 17, 2015 5:43 PM, "Víctor Adrián de la Cruz Serrano" <
notifications@github.com> wrote:

I just switched from Mongoid (MongoDB) to NoBrainer (RethinkDB) for a new
project.

The migration was mostly painless. But I have found an intermitent error
that says something along the lines:

rake test
Run options: --seed 23337

Running:

**_E_

Fabulous run in 0.366772s, 24.5384 runs/s, 40.8973 assertions/s.

  1. Error:
    API::RecetasController#test_0001_debe regresar la lista de recetas:
    SystemStackError: stack level too deep
    app/controllers/api/recetas_controller.rb:4:in index' test/controllers/api/recetas_controller_test.rb:11:inblock (2 levels) in <top (required)>'

9 runs, 15 assertions, 0 failures, 1 errors, 0 skips

The code in question is this:

class API::RecetasController < ApplicationController
def index
@recetas = Receta.all
respond_with( @recetas )
end
...end

I'm kind of new to the NoSQL party, maybe I'm doing it wrong or something,
but I figured I could ask here for pointers. What's surprising to me is
that sometimes the test runs without problem, and sometimes it breaks.

If I do a rake nobrainer:reset it stops breaking. Then what's the error
about?
I have found that it happens sometimes when Receta.all.to_json is called.

I guess the right way to do it is with Receta.all.to_a before a .to_json
is called?


Reply to this email directly or view it on GitHub
#134.

Contributor

ajselvig commented Apr 18, 2015

Try Receta.all.entries
On Apr 17, 2015 5:43 PM, "Víctor Adrián de la Cruz Serrano" <
notifications@github.com> wrote:

I just switched from Mongoid (MongoDB) to NoBrainer (RethinkDB) for a new
project.

The migration was mostly painless. But I have found an intermitent error
that says something along the lines:

rake test
Run options: --seed 23337

Running:

**_E_

Fabulous run in 0.366772s, 24.5384 runs/s, 40.8973 assertions/s.

  1. Error:
    API::RecetasController#test_0001_debe regresar la lista de recetas:
    SystemStackError: stack level too deep
    app/controllers/api/recetas_controller.rb:4:in index' test/controllers/api/recetas_controller_test.rb:11:inblock (2 levels) in <top (required)>'

9 runs, 15 assertions, 0 failures, 1 errors, 0 skips

The code in question is this:

class API::RecetasController < ApplicationController
def index
@recetas = Receta.all
respond_with( @recetas )
end
...end

I'm kind of new to the NoSQL party, maybe I'm doing it wrong or something,
but I figured I could ask here for pointers. What's surprising to me is
that sometimes the test runs without problem, and sometimes it breaks.

If I do a rake nobrainer:reset it stops breaking. Then what's the error
about?
I have found that it happens sometimes when Receta.all.to_json is called.

I guess the right way to do it is with Receta.all.to_a before a .to_json
is called?


Reply to this email directly or view it on GitHub
#134.

@lobo-tuerto

This comment has been minimized.

Show comment
Hide comment
@lobo-tuerto

lobo-tuerto Apr 18, 2015

Excellent, thank you very much!

Excellent, thank you very much!

@nviennot

This comment has been minimized.

Show comment
Hide comment
@nviennot

nviennot Apr 18, 2015

Owner

Seems fishy to me. If you could share your terminal with me so I can inspect closer, that's be great.

You can use http://tmate.io/ -- email me your ssh conection

Owner

nviennot commented Apr 18, 2015

Seems fishy to me. If you could share your terminal with me so I can inspect closer, that's be great.

You can use http://tmate.io/ -- email me your ssh conection

@nviennot nviennot closed this in cd107e6 Apr 18, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment