Jruby's threadsafe mode + Db2 connection close

We had ruby on rails application, which we have now migrated to jruby so
that it is deployed on websphere application server. We are now using
activerecord-jdbc-adapter and our database is db2. We enabled threadsafe
mode of jruby in production settings. Application was working fine for 3
days since deployment and then suddently we saw this error in
production.log file.

ActiveRecord::StatementInvalid (ActiveRecord::JDBCError:
[jcc][t4][10335][10366][3.63.75] Invalid operation: Connection is
closed. ERRORCODE=-4470, SQLSTATE=08003: (select * from
schema.table_name)

gems/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract_adapter.rb:219:in
log' gems/gems/activerecord-jdbc-adapter-1.2.0/lib/arjdbc/jdbc/adapter.rb:208:inexecute’
gems/gems/activerecord-jdbc-adapter-1.2.0/lib/arjdbc/jdbc/adapter.rb:334:in
select' gems/gems/activerecord-jdbc-adapter-1.2.0/lib/arjdbc/jdbc/adapter.rb:227:injdbc_select_all’
gems/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/query_cache.rb:60:in
select_all_with_query_cache' gems/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/query_cache.rb:81:incache_sql’
gems/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/query_cache.rb:60:in
select_all_with_query_cache' gems/gems/activerecord-2.3.5/lib/active_record/base.rb:661:infind_by_sql’
gems/gems/activerecord-2.3.5/lib/active_record/base.rb:1548:in
find_every' gems/gems/activerecord-2.3.5/lib/active_record/base.rb:615:infind’
app/models/pme_record.rb:504:in get_all_records' app/controllers/pme_record_edit_controller.rb:717:inadd_record_date’
org/jruby/RubyKernel.java:2076:in `send’

This error is logged in production.log for almost 3 out of 4 requests
now and user gets ‘something went wrong error screen’. Anybody have idea
of what is going wrong. We had this application deployed on test server
for almost 1 month, and we didn’t saw this error before.

Would disabling config.threadsafe! property in production.rb file help??

I don’t think it is thread related. Google says this about the DB2
error:
http://www-01.ibm.com/support/docview.wss?uid=swg21461670

The JDBC driver handles things differently than the native driver, seems
like your code might be trying to access cursors that are closed? I’m
not
a DBA, but know the fickleness of WAS/DB2.

Chris

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs