From the console I cannot do any operation that touches the database. I get a Segmentation fault.
.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/pg-1.1.4/lib/pg.rb:56: [BUG] Segmentation fault at 0x0000000000000110
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin18]
It is literally any operation that might need the database, including MyModel.new.
-- Control frame information -----------------------------------------------
c:0071 p:---- s:0406 e:000405 CFUNC :initialize
c:0070 p:---- s:0403 e:000402 CFUNC :new
c:0069 p:0016 s:0398 e:000397 METHOD /Users/xxx/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/pg-1.1.4/lib/pg.rb:56
c:0068 p:0107 s:0393 e:000392 METHOD /Users/xxx/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activerecord-6.0.1/lib/active_record/connection_adapters/postgres
I have uninstalled and reinstalled the pg gem. And rebuilt the database. And restarted PostgreSQL.
I have seen other people reporting the problem when running under Puma, but my configuration works under Puma, fails under console!
Edit for clarity:
Yes, using bundler.
Starting the rails console either with rails c
or bundle exec rails c
has the same effect (segfault) with same stack trace.
Gemfile.lock has pg (1.1.4)
I re-bundled, specifying a bundle path. The stack trace now has that bundle path, so I guess by default bundler was using the rbenv path.
bundle exec
in that case. – Enos