LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > Ruby/Rails > ruby-oci8 and connection reuse

Reply
 
Thread Tools Display Modes
  #1  
Old 08-22-2009, 04:21 PM
zellster zellster is offline
Senior Member
 
Join Date: Sep 2004
Posts: 55
Default ruby-oci8 and connection reuse

Configuration:

LiteSpeed Std for Linux v3.3.24
LSAPI v3.5
Ruby v1.8.6
Rails v1.2.6
ruby-oci8 v1.0.6

After configuring my Rails application to work with LiteSpeed, connecting to the site results in the following exception:

RuntimeError (The connection cannot be reused in the forked process.):
/usr/local/lib/site_ruby/1.8/oci8.rb:683:in `initialize'
/usr/local/lib/site_ruby/1.8/oci8.rb:247:in `new'
/usr/local/lib/site_ruby/1.8/oci8.rb:247:in `exec'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.6/lib/active_record/connection_adapters/oracle_adapter.rb:629:in `ping'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.6/lib/active_record/connection_adapters/oracle_adapter.rb:198:in `active?'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.6/lib/active_record/connection_adapters/abstract_adapter.rb:93:in `verify!'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:109:in `verify_active_connections!'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:108:in `each_value'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:108:in `verify_active_connections!'
/usr/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/dispatcher.rb:110:in `prepare_application'
/usr/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/dispatcher.rb:39:in `dispatch'
/opt/lsws/fcgi-bin/RailsRunner.rb:32

The error goes away if I comment out the following line in RailsRunner.rb:

#ActiveRecord::Base.connection.disconnect! and @reconnect = true if defined?(ActiveRecord::Base)

Is this due to the older version of Rails I am running, or something else to do with Oracle? The only docs I could find about this issue is from here:

http://groups.google.com/group/phusi...0d4770bc1d00b8
Reply With Quote
  #2  
Old 08-22-2009, 05:15 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
The DB connection must be closed after Rails application initialization bofore forking children process to serve requests.

Quote:
ActiveRecord::Base.clear_active_connections! if defined?(ActiveRecord::Base)
Works for MySQL, may have issue with oracle, so you may need to close it explicitly at the end of initialization code of your app.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 06:23 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.