from soap4r-ml
Hi,
I've found a problem with my RoR website, and I don't know if the bug
is in my code, soap4r, or http-access2.
My site uses soap4r to talk to a CRM application on another server, to
log tickets etc. It worked fine for ages, then the mongrel cluster
members started hanging. I could see (using 'lsof') hundreds of TCP
socket connections to the CRM server stuck in CLOSE_WAIT.
I have now worked out that at some point I must have installed a Gem
which depended on the rubyforge gem, which includes http-access2. When
soap4r starts up, StreamHandler.rb tries to use http-access2, and
falls back to using SOAP::NetHttpClient if it can't. So, by installing
the rubyforge gem, I inadvertently changed the way soap4r worked.
I have for now got my application working reliably again by putting
the following lines in environment.rb:
# Force SOAP4r to use Net/http instead of http-access2
require 'soap/netHttpClient'
SOAP::HTTPStreamHandler::Client = SOAP::NetHttpClient
SOAP::HTTPStreamHandler::RETRYABLE = false
Now, I have found that I can prevent the CLOSE_WAITs by changing my
code so that it calls ::SOAP::RPC::Driver#reset_stream after I've
finished with any SOAP calls I'm making. So my question to the list
is:
Should I modify all of my code so that it calls reset_stream after any
SOAP call?
-or-
should soap4r itself be doing something to prevent the problem
occurring?
-or-
is there a bug in http-access2? Is it failing to notice the CLOSE_WAIT
sockets?
I've tried using the latest http-access2 code from svn thinking it
might be a bug in the version included in the rubyforge gem. That
didn't help.
The SOAP server I'm talking to is hosted on Apache Tomcat on Windows,
the RoR site is running on either Mac OS X (development) or Linux
(staging / production).