ActionWebService vs. fcgi

Hi,

I have a rails-2 app that is using ActionWebService to talk to another
application.

I'm running my production app from apache, on Linux, using fcgi.

It works fine in my development environment from webrick, and it also
works using a standard cgi handler, but I'm having trouble when I
switch to fcgi.

When using fcgi, normal web pages on my app work, and two of my three
soap methods work. The other works ONCE, and then fails on subsequent
calls (from somewhere inside actionwebservice) -- before it actually
calls into my controller.

If I kill the fcgi process and re-attempt the request, it works the
next time, but fails again on all subsequent attempts.

I've tried mucking about with adding some diagnostic code to
action_web_service/dispatcher/action_controller_dispatcher.rb and what
I've found is that ActiveRecord will always blow up complaining about
a missing method in nil:NilClass, if I do anythng (such as .inspect)
with the ws_request object returned from discover_web_service_request
on line 49 of that file.

Here's a backtrace...

undefined method `has_key?' for nil:NilClass
<cause xsi:type="n3:NoMethodError"
xmlns:n3="http://www.ruby-lang.org/xmlns/ruby/type/1.6">
           <message xsi:type="xsd:string">undefined method
`has_key?&apos; for nil:NilClass</message>
           <backtrace xsi:type="n1:Array"
               n1:arrayType="xsd:anyType[47]">
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/activerecord/lib/active_record/base.rb:2406:in
`has_attribute?&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/activerecord/lib/active_record/base.rb:2462:in
`inspect&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/activerecord/lib/active_record/base.rb:2461:in
`collect&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/activerecord/lib/active_record/base.rb:2461:in
`inspect&apos;</item>
             <item
xsi:type="xsd:string">/usr/lib64/ruby/1.8/soap/mapping/registry.rb:73:in
`inspect&apos;</item>
             <item
xsi:type="xsd:string">/usr/lib64/ruby/1.8/soap/mapping/registry.rb:73:in
`collect&apos;</item>
             <item
xsi:type="xsd:string">/usr/lib64/ruby/1.8/soap/mapping/registry.rb:73:in
`inspect&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb:55:in
`dispatch_web_service_request&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb:54:in
`open&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb:54:in
`dispatch_web_service_request&apos;</item>
             <item xsi:type="xsd:string">(eval):1:in `api&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/actionpack/lib/action_controller/base.rb:1162:in
`send&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/actionpack/lib/action_controller/base.rb:1162:in
`perform_action_without_filters&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/actionpack/lib/action_controller/filters.rb:580:in
`call_filters&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/actionpack/lib/action_controller/filters.rb:573:in
`perform_action_without_benchmark&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue&apos;</item>
             <item
xsi:type="xsd:string">/usr/lib64/ruby/1.8/benchmark.rb:293:in
`measure&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/actionpack/lib/action_controller/rescue.rb:201:in
`perform_action_without_caching&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:in
`perform_action&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in
`cache&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in
`cache&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in
`perform_action&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/actionpack/lib/action_controller/base.rb:529:in
`send&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/actionpack/lib/action_controller/base.rb:529:in
`process_without_filters&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/actionpack/lib/action_controller/filters.rb:569:in
`process_without_session_management_support&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/actionpack/lib/action_controller/session_management.rb:130:in
`process&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/actionpack/lib/action_controller/base.rb:389:in
`process&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:149:in
`handle_request&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:107:in
`dispatch&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in
`synchronize&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in
`dispatch&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:120:in
`dispatch_cgi&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:35:in
`dispatch&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/railties/lib/fcgi_handler.rb:103:in
`process_request&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/railties/lib/fcgi_handler.rb:153:in
`with_signal_handler&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/railties/lib/fcgi_handler.rb:101:in
`process_request&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/railties/lib/fcgi_handler.rb:78:in
`process_each_request&apos;</item>
             <item
xsi:type="xsd:string">/usr/lib64/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:612:in
`each_cgi&apos;</item>
             <item
xsi:type="xsd:string">/usr/lib64/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in
`each&apos;</item>
             <item
xsi:type="xsd:string">/usr/lib64/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:609:in
`each_cgi&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/railties/lib/fcgi_handler.rb:77:in
`process_each_request&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/railties/lib/fcgi_handler.rb:76:in
`catch&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/railties/lib/fcgi_handler.rb:76:in
`process_each_request&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/railties/lib/fcgi_handler.rb:50:in
`process!&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/vendor/rails/railties/lib/fcgi_handler.rb:24:in
`process!&apos;</item>
             <item
xsi:type="xsd:string">/var/www/activation.widgit.com/bubblewrap/public/dispatch.fcgi:24</item>
           </backtrace>
         </cause>
         <excn_type_name xsi:type="xsd:string">NoMethodError</excn_type_name>

Thanks,
Simon

CONFIDENTIALITY NOTICE:
This email and any attachments are for the exclusive and confidential use of the intended recipient. If you are not the intended recipient, please do not read, distribute or take action in reliance upon this message. If you have received this in error, please notify us immediately by return email and promptly delete this message and its attachments from your computer system.

Logotron is a limited company registered in England, number 04113866. The registered office is Logotron Ltd, Denny Lodge Business Park, Chittering, Cambridge, CB25 9PH.