socket0 - Software caused connection abort. Error code : 10053

症状: Action.c(16): Error : socket0 - Software caused connection abort. Error code : 10053.
<wbr></wbr>
分析:10053这个错误,产生于socket通讯过程中,通常是这么回事:
正常的C/S通讯过程是:<wbr><wbr><br> Server Listen--&gt; Client Connect--&gt; Server Accept --&gt; Client Send --&gt; Server Recv--&gt; Client Close --&gt; Server Close<br> 如果Client端不主动关闭连接而直接退出,则Server端的服务线程会引发一个10053错误(这种错误通常影响不太大), 而如果通讯过程中Server首先主动关闭连接,则Client端也会引发一个10053错误<br><br> 网络不好的时候的情况通常是指后者,Client以为Server关了(实际是网络断了), 所以就大叫10053</wbr></wbr>

最新发现:

最近使用LoadRunner进行Winsock协议的性能测试时,测试的WebServer是JBoss,经常出现10053错误,现象如下:当我用lrs_create_socket创建连接之后,当这个socket连接的请求次数达到100次后,这个连接就不可用了,必须close后再重新create。LoadRunner提示错误:Error : socket0 - Software caused connection abort. Error code : 10053.

经过多次探索,终于发现该错误是由于Apach HTTPServer中HTTP 1.1 版本KeepAlive参数 的配置原因导致的。从我对多个不同WebServer的测试结果来看,在一个Socket连接进行100个请求时出错的有JBoss和Tomcat,其它Web服务器如IIS、WebLogic均没有该问题。
下面介绍几个相关的参数:KeepAlive 、KeepAliveTimeout、MaxKeepAliveRequests。

KeepAlive Directive
Description: Enables HTTP persistent connections
Syntax: KeepAlive On|Off
Default: KeepAlive On
Context: server config, virtual host
Status: Core
Module: core

在HTTP 1.0中,一次连接只能作传输一次HTTP请求,而KeepAlive参数用于支持HTTP 1.1版本的一次连接、多次传输功能,这样就可以在一次连接中传递多个HTTP请求。虽然只有较新的浏览器才支持这个功能,但还是打开使用这个选项。

The Keep-Alive extension to HTTP/1.0 and the persistent connection feature of HTTP/1.1 provide long-lived HTTP sessions which allow multiple requests to be sent over the same TCP connection. In some cases this has been shown to result in an almost 50% speedup in latency times for HTML documents with many images. To enable Keep-Alive connections, set KeepAlive On.

For HTTP/1.0 clients, Keep-Alive connections will only be used if they are specifically requested by a client. In addition, a Keep-Alive connection with an HTTP/1.0 client can only be used when the length of the content is known in advance. This implies that dynamic content such as CGI output, SSI pages, and server-generated directory listings will generally not use Keep-Alive connections to HTTP/1.0 clients. For HTTP/1.1 clients, persistent connections are the default unless otherwise specified. If the client requests it, chunked encoding will be used in order to send content of unknown length over persistent connections.

----------------------

KeepAliveTimeout Directive
Description: Amount of time the server will wait for subsequent requests on a persistent connection
Syntax: KeepAliveTimeout seconds
Default: KeepAliveTimeout 15
Context: server config, virtual host
Status: Core
Module: core

KeepAliveTimeout测试一次连接中的多次请求传输之间的时间,如果服务器 已经完成了一次请求,但一直没有接收到客户程序的下一次请求,在间隔超过了 这个参数设置的值之后,服务器就断开连接。

The number of seconds Apache will wait for a subsequent request before closing the connection. Once a request has been received, the timeout value specified by the Timeout directive applies.

Setting KeepAliveTimeout to a high value may cause performance problems in heavily loaded servers. The higher the timeout, the more server processes will be kept occupied waiting on connections with idle clients.

----------------------

MaxKeepAliveRequests Directive
Description: Number of requests allowed on a persistent connection
Syntax: MaxKeepAliveRequests number
Default: MaxKeepAliveRequests 100
Context: server config, virtual host
Status: Core
Module: core

MaxKeepAliveRequests为一次连接可以进行的HTTP请求的最大请求次数。将其值设为0将支持在一次连接内进行无限次的传输请求。事实上没有客户程序在一次连接中请求太多的页面,通常达不到这个上限就完成连接了。

The MaxKeepAliveRequests directive limits the number of requests allowed per connection when KeepAlive is on. If it is set to 0, unlimited requests will be allowed. We recommend that this setting be kept to a high value for maximum server performance.

For example:MaxKeepAliveRequests 500

最后,虽然这个问题是由于HTTPServer的参数配置引起的,但只有LoadRunner才会出现这个问题,如果用Rational Robot实现同样的功能则没有该问题,由此估计和测试工具对Socket连接的实现策略也有一定的关系。


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值