title: WSO2 ESB HTTP connection was forcibly closed by remote host
body: <p>We are using <code>WSO2</code> <code>ESB</code> to clone and broadcast SOAP requests to all our web services, that are being hosted on <code>IIS</code>. Recently we switched to <code>nhttp</code> transport. It was configured as recommended <a href="http://docs.wso2.org/display/ESB460/Performance+Tuning" rel="nofollow">here</a> but each time after the period of inactivity we encount an exception in wso.log</p>
  
  <pre><code>[HTTP Sender I/O dispatcher-4] ERROR ClientHandler I/O error : An existing connection was forcibly closed by the remote host For : 127.0.0.1:4148
  java.io.IOException: An existing connection was forcibly closed by the remote host
      at sun.nio.ch.SocketDispatcher.read0(Native Method)
      at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
      at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
      at sun.nio.ch.IOUtil.read(IOUtil.java:197)
  ...
  </code></pre>
  
  <p>The length of inactivity period depends on the <code>'Connection Time-out value'</code> configured in IIS for the specific web service. Seems like WSO2 ESB hasn't closed all opened socket connections and <code>IIS</code> did it instead, when the time-out period has expired.</p>
  
  <p>Is there is a way to avoid this exception? It doesn't seem to cause some performance drawbacks, but looks quite messy in the error logs.</p>
  
  <p>Our configuration, responsible for threads count and timeouts is as follow:</p>
  
  <p><strong><code>nhttp.properties</code></strong> file:</p>
  
  <pre><code>http.socket.timeout=120000
  nhttp_buffer_size=16384
  http.tcp.nodelay=1
  http.connection.stalecheck=0
  http.block_service_list=false
  </code></pre>
  
  <p><strong><code>synapse.properties</code></strong> file:</p>
  
  <pre><code>synapse.threads.core = 40
  synapse.threads.max = 100
  #synapse.threads.keepalive = 5
  #synapse.threads.qlen = 10
  #synapse.threads.group = synapse-thread-group
  #synapse.threads.idprefix = SynapseWorker
  
  synapse.sal.endpoints.sesssion.timeout.default=600000
  synapse.global_timeout_interval=120000 
  </code></pre>