I have
Ruby 3.0.4
Rails 6.1.7
pg 1.4.5
postgresql 14.6
Here is my database.yml file
development:
adapter: postgresql
encoding: utf8
database: olio_development
username: postgres
password: password
pool: 5
host: 127.0.0.1
port: 5432
gssencmode: disable
When I run rake db:create I am getting the following segmentatin fault
/home/usr/.rvm/gems/ruby-3.0.4/gems/pg-1.4.5/lib/pg/connection.rb:626: [BUG] Segmentation fault at 0x00007fd79729a140
ruby 3.0.4p208 (2022-04-12 revision 3fa771dded) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0050 p:---- s:0275 e:000274 CFUNC :connect_poll
c:0049 p:0543 s:0271 e:000270 METHOD /home/suganya/.rvm/gems/ruby-3.0.4/gems/pg-1.4.5/lib/pg/connection.rb:626
The connection fails.
I have verified postgres is running and is on host 127.0.0.1 and post 5432.
Please help me how to resolve this segmentation fault?
I'm seeing a GitHub issue for the pg gem (https://github.com/ged/ruby-pg/issues/493) that matches your problem, so it might be a bug with pg v1.4.5. I would try pinning it to an older version:
gem 'pg', '1.4.4'
And work your way backwards if that still has issues. You can also add your information to the GitHub issue linked above to help the maintainers resolve the issue.
Related
Building a rails app on heroku (locally). Following their tutorials for rails, and installing postgres locally.
When ever I run the server or generate a migration I get the following err:
LoadError (Could not load 'active_record/connection_adapters/posgtres_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile.):
database.yml:
default: &default
adapter: postgresql
encoding: unicode
pool: 5
development:
<<: *default
database: myapp_development
username: Name
password: secret
host: localhost
Gem file has: gem 'rails' '4.2.0', and gem 'pg' installed
my machine's OS: Windows 64x
Any and all help appreciated.
Doubtful this is the same issue you are having but, posting these details in case it gives a lead. I'm using Windows 10
I had the same error message. To troubleshoot, I tried to do a reinstall of pg with 'gem install pg' but a file was locked.
Found I had a process still using one of the PG files and shut down the process, deleted the entire pg directory found at C:\Ruby200-x64\lib\ruby\gems\2.0.0\gems\pg-0.18.3-x64-mingw32
Reran 'gem install pg' rake db:setup, rake db:create, rake db:migrate and the error was gone.
I just installed PostgreSQL with homebrew:
$ brew install postgresql
I installed the pg gem with:
$ gem install pg -- --with-pg-config= '/usr/local/var/postgres/postgresql.conf'
I changed my app's database.yml to
development:
adapter: postgresql
encoding: unicode
database: rails_dev
pool: 5
username: vise890
password:
test:
adapter: postgresql
encoding: unicode
database: rails_test
pool: 5
username: vise890
password:
production:
adapter: postgresql
encoding: unicode
database: ddb
port: 5432
pool: 5
username: postgres
password: admin
However, whenever i load any page I get the error:
ActiveRecord::ConnectionNotEstablished
I can connect to the db with pgAdmin (u:vise890 P:{none}) and i see the databases.
I am doing example3 from the Ruby on Rails Tutorial
If you want to check the whole thing: Sample App github branch
Thanks in advance guys!
Ok, nevermind. I started from scratch and it worked. Here's the walkthrough in case you are interested
I am following a simple tutorial and i am using mysql. when i run
jruby -S rake db:create:all
it gives an error message:
Please install the jdbcmysql adapter: `gem install activerecord-jdbcmysql-adapter` (no such file to load -- active_record/connection_adapters/jdbcmysql_adapter)
But I already have this installed. anyone know how to solve this problem? I am using JRuby 1.6.7. (I also have ruby 1.9.3 on my computer, don't know if it matters)
here's my database.yml
development:
adapter: jdbcmysql
database: MyRail2_development
pool: 5
username: root
password: *****
host: localhost
Have you made sure that your Gemfile includes a line that references the adapter gem? e.g.:
platforms :jruby do
gem 'activerecord-jdbc-adapter'
gem 'activerecord-jdbcmysql-adapter'
end
And did you run bundle install, after you updated your GemFile? i.e.:
jruby -S bundle install
It shouldn't matter that you have MRI Ruby 1.9.3 on your machine, as long as you remember to execute the usual Rails tutorial commands prefixed with jruby -S, as you've indicated in your question.
I have 2 environments: development and development_with_production_data.
The environments only differ in their database.yml entries:
development:
host: 127.0.0.1
adapter: mysql2
encoding: utf8
database: [REDACTED]_development
username: root
password:
pool: 5
development_with_production_data:
host: [REDACTED]
port: [REDACTED]
adapter: mysql2
encoding: utf8
database: [REDACTED]_production
username: [REDACTED]
password: [REDACTED]
pool: 5
I have verified that the values I have [REDACTED] above are the correct values. I have a gui that can connect just fine and a rails 2 app that connects with the same [REDACTED] values.
Loading up and working on the development environment work perfect, locally.
Loading up and working on the development_with_production_data environment will not even anything but static, cached pages. No error messages, no timeouts, nothing. All I see is this:
coneybeare $ rails s -e development_with_production_data
NOTE: Gem::SourceIndex#all_gems is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::SourceIndex#all_gems called from /opt/local/lib/ruby/gems/1.8/gems/bundler-1.0.13/lib/bundler/rubygems_integration.rb:256
.
=> Booting WEBrick
=> Rails 3.0.7 application starting in development_with_production_data on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-05-09 01:23:48] INFO WEBrick 1.3.1
[2011-05-09 01:23:48] INFO ruby 1.8.7 (2009-06-12) [i686-darwin10]
[2011-05-09 01:23:48] INFO WEBrick::HTTPServer#start: pid=3854 port=3000
I am using rails 3.0.7 and have tried both mysql2 0.3.2 and mysql2 0.2.7
What could be causing this?
I finally solved this by updating my ruby to 1.9.2 on my mac using RVM. Then I had to reinstall the bundle gem, rails gem, and do a bundle install. Previously I had been using 1.8.7 and for some reason, it was causing the hang.
Try to install mysql2 0.2.x because there is some issues with mysql2 0.3.x in rails 3.0.7
Whenever I try to use rake db:schema:load or rake db:migrate, I get keep getting the following error:
The bundled mysql.rb driver has been removed from Rails 2.2.
Please install the mysql gem and try again: gem install mysql.
rake aborted!
no such file to load — mysql
I already have the mysql gem installed which is version 2.8.1. Am I missing something?
database.yml
development:
adapter: mysql
database: db_development
host: localhost
username: root
password: password
encoding: utf8
socket: /Applications/rubystack/mysql/tmp/mysql.sock
Try installing mysql2 gem
sudo gem install mysql2
If you are on Rails 3, add
gem 'mysql2'
to your Gemfile & run
bundle install
And change the adapter to mysql2 in your database.yml. I solved many problems with this, might solve yours too.