Rails and PostgreSQL


#1

I’m trying to get Rails up and running using a PostgreSQL database, and
unfortunately I’m doing this on a machine I don’t administer directly.

I can get Rails responding using the WEBrick server, and ‘hello, world’
pages work fine.

However, after creating a database (on a seperate server) I can’t seem
to
get Rails speaking to it. At first, the Postgres gem wasn’t installed,
but
I had the sysadmin put that in. Now, though, I’m getting this error:

Processing CraftController#new (for 141.161.18.159 at Wed Dec 07
14:32:38
PST 2005)
Parameters: {“action”=>“new”, “controller”=>“craft”}

NoMemoryError (failed to allocate memory):
/usr/local/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/buffer.rb:64:in
read' /usr/local/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/buffer.rb:64:incopy_from_stream’
/usr/local/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/message.rb:41:in
read' /usr/local/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/connection.rb:30:ininitialize’
/usr/local/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/connection.rb:29:in
loop' /usr/local/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/connection.rb:29:ininitialize’
/usr/local/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0
/lib/postgres-pr/postgres-compat.rb:23:in new' /usr/local/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0 /lib/postgres-pr/postgres-compat.rb:23:ininitialize’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in
connect' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/connection_adapters/postgresql_adapter.rb:37:inpostgresql_connection’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/query_cache.rb:52:in
send' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/query_cache.rb:52:inconnection=’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/connection_adapters/abstract_adapter.rb:108:in
retrieve_connection' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/base.rb:239:inconnection’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/base.rb:246:in
connection' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/base.rb:1322:inattributes_from_column_definition’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/base.rb:928:in
initialize_without_callbacks' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/callbacks.rb:236:ininitialize’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/scaffolding.rb:116:in
new' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/scaffolding.rb:116:innew’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:756:in
send' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:756:inperform_action_without_filters’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/filters.rb:295:in
perform_action_without_benchmark' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:inperform_action_without_rescue’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in
measure' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:inperform_action_without_rescue’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/rescue.rb:80:in
perform_action' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:insend’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in
process' /usr/local/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/dispatcher.rb:32:indispatch’
/usr/local/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:105:in
handle_dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:71:inservice’
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in service' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:inrun’
/usr/local/lib/ruby/1.8/webrick/server.rb:155:in start_thread' /usr/local/lib/ruby/1.8/webrick/server.rb:144:instart’
/usr/local/lib/ruby/1.8/webrick/server.rb:144:in start_thread' /usr/local/lib/ruby/1.8/webrick/server.rb:94:instart’
/usr/local/lib/ruby/1.8/webrick/server.rb:89:in each' /usr/local/lib/ruby/1.8/webrick/server.rb:89:instart’
/usr/local/lib/ruby/1.8/webrick/server.rb:79:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:79:instart’
/usr/local/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/webrick_server.rb:57:in
`dispatch’
script/server:49

So, it looks like it’s something with memory, but… I can’t figure out
what. Has anyone else run into this? I’m running against a 7.3
database,
though, I’d heard Rails likes 8 and later, although, I’d also heard that
had
been fixed.

Any help appreciated.

Thanks,
Colin F.


#2

What output do you get when you run “free” in a shell?


#3

On 12/7/05, Colin F. removed_email_address@domain.invalid wrote:

I’m trying to get Rails up and running using a PostgreSQL database, and
unfortunately I’m doing this on a machine I don’t administer directly.

Rails-specific questions should go on the Rails mailing list.
http://lists.rubyonrails.org/mailman/listinfo/rails


#4

Roger that, Joe.

Looks like my problem goes away using PostgreSQL 8, though, for anyone
here
who might run into the same problem.


#5

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Dec 7, 2005, at 9:43 PM, Colin F. wrote:

Looks like my problem goes away using PostgreSQL 8, though, for
anyone here
who might run into the same problem.

I’ve had better results with the C bindings as well:
gem install postgres

Best,
jeremy

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (Darwin)

iD8DBQFDl8u7AQHALep9HFYRAjR+AJ9KunBM98iEDSaF/fQjQmxDvYfiqACfcOOe
Ybdx0yy9c29ImiK4xXMYO3s=
=uy07
-----END PGP SIGNATURE-----


#6

On Thu, 2005-12-08 at 14:59 +0900, Jeremy K. wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Dec 7, 2005, at 9:43 PM, Colin F. wrote:

Looks like my problem goes away using PostgreSQL 8, though, for
anyone here
who might run into the same problem.

I’ve had better results with the C bindings as well:
gem install postgres

Same here!

Robby


/******************************************************