9

I recently upgraded my snow leopard to lion and in one of my apps i get

=> Booting WEBrick
=> Rails 3.0.4 application starting in development on http://0.0.0.0:4000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-08-16 17:47:27] INFO  WEBrick 1.3.1
[2011-08-16 17:47:27] INFO  ruby 1.9.2 (2011-07-09) [x86_64-darwin11.0.0]
[2011-08-16 17:47:27] INFO  WEBrick::HTTPServer#start: pid=3460 port=4000
Trace/BPT trap: 5

the app quits and there is no other output , it does run with sqlite3 as the db gem. I commented all other gems but this one and still got the erros. i see this error not when the app is loading but when it tries to answer the first request.

Anyone knows another gem to connect to postgresql or any workaround?

EDIT: OK here is some clarification.

I started this project on snow leopard and it worked perfectly, I had rvm installed , the pg gem, webrick and ruby 1.9.2-p180, I upgraded to lion and keep working on other projects, when the time come to update this project , i got the Trace/BPT trap: 5 error, and the server gives no other clue of what is going on. My guess is that this is something very low level and the ruby interpreter does not even gets the chance to show the exception and this message is STDIO related.

Trying to fix this i have: reinstalled rvm , installed ruby 1.9.2-p290, reinstalled postgresql, deleted and rebuild the gemset for the project, installed mongrel and still the app crashes web it gets the first web request, note that it does work on the rails console.

EDIT 2: It is now running on ruby-1.8.7-352 so it seem is a 1.9.2 related issue on MAC OS X 10.7

EDIT 3: Is a XCODE 4.1 issue that has to do with llvm compiler and the "optimization" it does when there is need to build with native extension. The solution is to install a compatible Xcode, more info can be found at the RVM site.

radha
  • 458
  • 5
  • 9
  • you might need to recompile/reinstall your postgres again. are you using homebrew? – corroded Aug 17 '11 at 02:38
  • also you might need to recompile your pg gem. have you tried reinstalling it? – corroded Aug 17 '11 at 02:39
  • reinstalled rvm reinstalled postgresql when uninstall installing pg i got Error loading RubyGems plugin "/Users/XXXXXXX/.rvm/gems/ruby- 1.9.2-p290@oloback/gems/yard-0.6.4/lib/rubygems_plugin.rb": undefined method `overwrite_accessor' for Gem::Specification:Class (NoMethodError) and yard does not work since since i recreated the gemset reinstall pg gem get the same error. I see a thread from 2010 at the pg gem issue tracker where people got this same error on snow leopard with webrick. I have no other clues – radha Aug 17 '11 at 03:36
  • 1
    [**this**](https://bitbucket.org/ged/ruby-pg/issue/48/ruby-192-rails-3-launching-server) is the thread. I can also get the console to work – radha Aug 17 '11 at 03:41
  • the snow leopard problem might not apply to you since you're on lion already though – corroded Aug 17 '11 at 03:47
  • wait im a bit confused, you reinstalled rvm, then postgres, then the pg gem? and it breaks where? can you please update the question with what you've odne? thanks! – corroded Aug 17 '11 at 03:48
  • seeing something similar - check this thread too http://stackoverflow.com/questions/8032824/cant-install-ruby-under-lion-with-rvm-gcc-issues – andy boot Mar 21 '12 at 10:06
  • I got this error when I set a breakpoint in the Postgres `server process`, rather than the `backend process`. When I disable breakpoints it goes away. So perhaps its related to some kind of debugging flag or something. – vaughan Jul 13 '21 at 22:26

2 Answers2

9

I fixed this - it was a simple issue of a missing "gem 'pg'" in my Gemfile. For various reasons it had been commented out.

Anna Billstrom
  • 2,482
  • 25
  • 33
  • I had a similar situation with a dummy app within a Rails Engine. I just needed to add a `require "pg"` to my application.rb. – balexand Oct 10 '13 at 17:48
1

Try the following:

gem uninstall pg
env ARCHFLAGS="-arch x86_64" gem install pg

I had the same problem and this solution worked for me. I am running Ruby 1.9.2 p136, Rails 3.0.1, Postgresql 9.0.4 and the pg gem version 0.11.0.

I am of course assuming that you have also correctly configured your Gemfile to use the 'gem pg', and that you don't have any other database gems active in there, and that you have a working database that you can access with psql coupled with a properly configured database.yml file in rails.

Hope this works for you, Erik

eriklinde
  • 431
  • 6
  • 7
  • Thx but the problem is MAC OS X lion related, is a XCODE 4.1 issue that has to do with llvm compiler and the "optimization" it does when there is need to build with native extension. The solution is to downgrade to snow leopard while lion and xcode get fixed – radha Sep 15 '11 at 23:58