Can not run in threadsafe mode within a WAR file successfully
-------------------------------------------------------------

                 Key: JRUBY-3220
                 URL: http://jira.codehaus.org/browse/JRUBY-3220
             Project: JRuby
          Issue Type: Bug
          Components: Rails WAR Deployment
    Affects Versions: JRuby 1.1.5, JRuby 1.1.6
         Environment: Either Window XP or Linux running under Java JDK 1.6.0_04 
or better
Rails 2.2.2
Rack 0.9.2, 0.9.3 or 0.9.4_SNAPSHOT (as of Dec 5 2008)
JRuby 1.1.5 and JRuby 1.1.6RC1
            Reporter: Eric Gascoine


I'm trying to run a Rails 2.2.2 application under JRuby 1.1.5 (or 1.1.6RC1) 
inside a war file with config.threadsafe! set.
Warbler .9.11 (with jruby-complete and jruby-rack updated)
Other significant gems in use are activerecord-jdbc-adapter 0.9.0 

For requests that run sequentially (or even very close), this seems to work 
wonderfully fast and with no problems.

However long running processes produce stack traces like:

NoMethodError (undefined method `name' for nil:NilClass):
    /lib/identity.rb:43:in `current_user_name'
    /lib/auditing.rb:8:in `append_features'
    /vendor/rails/activesupport/lib/active_support/callbacks.rb:182:in `call'
    /vendor/rails/activesupport/lib/active_support/callbacks.rb:182:in 
`evaluate_method'
    /vendor/rails/activesupport/lib/active_support/callbacks.rb:166:in `call'
    /vendor/rails/activesupport/lib/active_support/callbacks.rb:93:in `run'
    /vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `each'
    /vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `run'
    /vendor/rails/activesupport/lib/active_support/callbacks.rb:277:in 
`run_callbacks'
    /vendor/rails/activerecord/lib/active_record/callbacks.rb:315:in `callback'
    /vendor/rails/activerecord/lib/active_record/callbacks.rb:221:in 
`create_or_update_with_callbacks'
    /vendor/rails/activerecord/lib/active_record/base.rb:2383:in `save'
    /vendor/rails/activerecord/lib/active_record/validations.rb:1009:in 
`save_with_validation'
    /vendor/rails/activerecord/lib/active_record/dirty.rb:79:in 
`save_with_dirty'
    /vendor/rails/activerecord/lib/active_record/transactions.rb:179:in 
`with_transaction_returning_status'
    
/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in
 `transaction'
    /vendor/rails/activerecord/lib/active_record/transactions.rb:129:in 
`transaction'
    /vendor/rails/activerecord/lib/active_record/transactions.rb:138:in 
`transaction'
    /vendor/rails/activerecord/lib/active_record/transactions.rb:178:in 
`with_transaction_returning_status'
    /vendor/rails/activerecord/lib/active_record/transactions.rb:146:in 
`save_with_transactions'
    /vendor/rails/activerecord/lib/active_record/transactions.rb:158:in 
`rollback_active_record_state!'
    /vendor/rails/activerecord/lib/active_record/transactions.rb:146:in 
`save_with_transactions'
    /lib/importWarTracker.rb:547:in `findOrCreateWebServer'
    /lib/importWarTracker.rb:120:in `importWebServers'
    /lib/importWarTracker.rb:106:in `each'
    /lib/importWarTracker.rb:106:in `importWebServers'
    /lib/importWarTracker.rb:98:in `import'
    
/usr/local/webservices/tomcat-servers/tomcatsrv01/work/Catalina/localhost/warManager/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/builtin/javasupport/core_ext/object.rb:96:in
 `handle_different_imports'
    /app/controllers/war_manager_controller.rb:9:in `import'
    
/usr/local/webservices/tomcat-servers/tomcatsrv01/work/Catalina/localhost/warManager/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/builtin/javasupport/core_ext/object.rb:96:in
 `handle_different_imports'
    /vendor/rails/actionpack/lib/action_controller/base.rb:1253:in 
`perform_action'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:617:in 
`call_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:610:in 
`perform_action_with_filters'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in 
`perform_action_with_benchmark'
    
/usr/local/webservices/tomcat-servers/tomcatsrv01/work/Catalina/localhost/warManager/loader/benchmark.rb:293:in
 `measure'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in 
`perform_action_with_benchmark'
    /vendor/rails/actionpack/lib/action_controller/rescue.rb:136:in 
`perform_action_with_rescue'
    /vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:in 
`perform_action_with_caching'
    
/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in
 `cache'
    /vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in `cache'
    /vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in 
`perform_action_with_caching'
    /vendor/rails/actionpack/lib/action_controller/base.rb:524:in `process'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:606:in 
`process_with_filters'
    /vendor/rails/actionpack/lib/action_controller/session_management.rb:134:in 
`process_with_session_management_support'
    /vendor/rails/actionpack/lib/action_controller/base.rb:392:in `process'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:183:in 
`handle_request'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:110:in 
`dispatch_unlocked'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:120:in 
`dispatch'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:132:in 
`dispatch_cgi'
    /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:39:in 
`dispatch'
    
/usr/local/webservices/tomcat-servers/tomcatsrv01/work/Catalina/localhost/warManager/loader/rack/adapter/rails.rb:37:in
 `serve_rails'
    
/usr/local/webservices/tomcat-servers/tomcatsrv01/work/Catalina/localhost/warManager/loader/rack/adapter/rails.rb:44:in
 `call'
    
/usr/local/webservices/tomcat-servers/tomcatsrv01/work/Catalina/localhost/warManager/loader/jruby/rack/rails.rb:145:in
 `call'
    
/usr/local/webservices/tomcat-servers/tomcatsrv01/work/Catalina/localhost/warManager/loader/rack/handler/servlet.rb:17:in
 `call'
    :1

I've tried to narrow this down and can offer the following observations:

1. I can not reproduce this under Mongrel (in production mode) with the patch 
for threadsafe applied 
(http://mongrel.rubyforge.org/attachment/ticket/48/mongrel.patch)
2. I can confirm that both (all) ruby threads are failing (except the short 
lived one) and only then cleaning up database resources properly.
3. The requests which fail will run to normal completion when there is not a 
concurrent request completion.
4. The application runs properly with non threadsafe! operations with Warbler 
9.11 

I'm at a loss of how to continue diagnosing this, so any and all suggestions 
would be helpful.  Please however bear in mind that I've already tried various 
version of the products, and validated that the active_records database 
resources are being returned AFTER the cause of the failure.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to