Skip to content
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

SystemStackError: stack level too deep on save model with RGeo::Geographic::SphericalPointImpl #81

Closed
danil-z opened this issue Sep 8, 2013 · 9 comments

Comments

@danil-z
Copy link

danil-z commented Sep 8, 2013

Hello, i follow blog tutorial and got strange error in rails console:

Place.create(latlon: 'POINT(1 1)')
   (7.2ms)  SELECT f_geometry_column,coord_dimension,srid,type FROM geometry_columns WHERE f_table_name='places'
   (0.3ms)  BEGIN
  SQL (5.3ms)  INSERT INTO "places" ("created_at", "latlon", "updated_at") VALUES ($1, $2, $3) RETURNING "id"  [["created_at", Sun, 08 Sep 2013 23:16:02 UTC +00:00], ["latlon", #<RGeo::Geographic::SphericalPointImpl:0x3fc250d2b73c "POINT (1.0 1.0)">], ["updated_at", Sun, 08 Sep 2013 23:16:02 UTC +00:00]]
   (0.5ms)  ROLLBACK
SystemStackError: stack level too deep
    from /usr/local/opt/rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/irb/workspace.rb:86
Maybe IRB bug!

my app is dead simple:

#app/models/place.rb
class Place < ActiveRecord::Base
  set_rgeo_factory_for_column(:latlon, RGeo::Geographic.spherical_factory(:srid => 4326))
end

#db/migrations/places.rb
class CreatePlaces < ActiveRecord::Migration
  def change
    enable_extension 'postgis'
    create_table :places do |t|
      t.point :latlon, :geographic => true

      t.timestamps
    end
  end
end

#Gemfile
#...
gem 'rails', '4.0.0'
gem 'activerecord-postgis-adapter'

#Gemfile.lock
#...
    rgeo (0.3.20)
    rgeo-activerecord (0.5.0)
      activerecord (>= 3.0.3)
      arel (>= 2.0.6)
      rgeo (>= 0.3.20)

#config/database.yml
development:
  adapter: postgis
  postgis_extension: postgis
  encoding: unicode
  database: some_development
  pool: 5
  host: localhost
  schema_search_path: '"$user", public, postgis'
$ brew info proj 
proj: stable 4.8.0
http://trac.osgeo.org/proj/
/usr/local/Cellar/proj/4.8.0 (47 files, 5,7M) *
  Built from source
From: https://github.com/mxcl/homebrew/commits/master/Library/Formula/proj.rb

$ brew info geos
geos: stable 3.4.2
http://trac.osgeo.org/geos
/usr/local/Cellar/geos/3.4.2 (385 files, 8,1M) *
  Built from source
From: https://github.com/mxcl/homebrew/commits/master/Library/Formula/geos.rb
==> Options
--universal
    Build a universal binary

and i'm using Postgressapp 9.2.4.3

@danil-z
Copy link
Author

danil-z commented Sep 8, 2013

seems
gem 'meta_request'

cause this error

@mrbrdo
Copy link

mrbrdo commented Sep 16, 2013

I have the same problem on a migration, it indeed goes away if I remove the meta_request gem.

@joshuap
Copy link

joshuap commented Sep 16, 2013

+1

@eidge
Copy link

eidge commented Dec 12, 2013

+1 any fix on this?

@DougHall
Copy link

+1 Same here. Removed meta_request gem.

@waissbluth
Copy link

I had the same problem. Also went away by removing meta_request.

@snkashis
Copy link

+1 had to remove meta_request gem. Posted trace in linked issue above.

@TangMonk
Copy link

TangMonk commented Jun 2, 2015

+1 remove meta_request gem, works fine.

@vfonic
Copy link

vfonic commented Oct 2, 2019

I'm still having this issue. Interesting bit is that this doesn't happen locally in development, but on CI/production. Any hints would be really helpful.

Locally:

>  geo
#<RGeo::Geos::CAPIPointImpl:0x3fea96a81388 "POINT (-72.99974601470639 41.54232501996399)">
>  geo.class
RGeo::Geos::CAPIPointImpl < Object
>  geo.to_s
"POINT (-72.99974601470639 41.54232501996399)"
>  geo.to_json
"\"POINT (-72.99974601470639 41.54232501996399)\""

On CI:

>  geo
=> #<RGeo::Cartesian::PointImpl:0x2b1646ef4ca0 "POINT (-72.7430602 41.7533888)">
>  geo.class
=> RGeo::Cartesian::PointImpl < Object
>  geo.to_s
=> "POINT (-72.7430602 41.7533888)"
>  geo.to_json
SystemStackError: stack level too deep
from /home/circleci/project/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/json.rb:171:in `each'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants