本文介绍了WSO2 ESB HTTP连接被远程主机强行关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用 WSO2 ESB 来克隆和广播SOAP请求到我们正在托管的所有Web服务在 IIS 上。最近我们切换到 nhttp 运输。它被配置为推荐的,但每次在不活动期间,我们都会wso.log中的异常

We are using WSO2 ESB to clone and broadcast SOAP requests to all our web services, that are being hosted on IIS. Recently we switched to nhttp transport. It was configured as recommended here but each time after the period of inactivity we encount an exception in wso.log

[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)
...

不活动时间长度取决于IIS中为特定Web服务配置的'连接超时值'。似乎WSO2 ESB没有关闭所有打开的套接字连接,而 IIS 则在超时期限到期时执行了此操作。

The length of inactivity period depends on the 'Connection Time-out value' configured in IIS for the specific web service. Seems like WSO2 ESB hasn't closed all opened socket connections and IIS did it instead, when the time-out period has expired.

有没有办法避免这种异常?它似乎没有导致一些性能缺陷,但在错误日志中看起来相当混乱。

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.

我们的配置,负责线程数和超时如下:

Our configuration, responsible for threads count and timeouts is as follow:

nhttp.properties 文件:

nhttp.properties file:

http.socket.timeout=120000
nhttp_buffer_size=16384
http.tcp.nodelay=1
http.connection.stalecheck=0
http.block_service_list=false

synapse.properties 文件:

synapse.properties file:

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


推荐答案

默认情况下,WSO2 ESB将使用'KEEPALIVE'f或连接。
当后端(例如IIS)不使用KEEPALIVE时,这将导致远程主机强行关闭现有连接错误消息。
使用以下属性禁用'KEEPALIVE':

By default WSO2 ESB will use 'KEEPALIVE' for connections.This will result in 'An existing connection was forcibly closed by the remote host' error message when the backend (e.g. IIS) does not use 'KEEPALIVE'.Use the following property to disable 'KEEPALIVE':

<property name="NO_KEEPALIVE" value="true" scope="axis2" type="STRING"/>

这篇关于WSO2 ESB HTTP连接被远程主机强行关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 04:07