我有一个正在运行的nodejs服务器,用于与客户端进行套接字通信。在一段时间(几天)之后,nodejs达到100%的CPU使用率。查看节点端口的netstat时,我发现有超过1k个连接处于FIN_WAIT2状态(应该只有大约50个活动连接)。我正在使用超时功能进行连接,在特定超时后调用end()。但这似乎并未关闭连接。那么end()是关闭套接字连接的有效方法还是应该使用其他方法?
经过几天google -ing /尝试/失去头发后,我仍然无法找到解决方案,所以请帮忙:)
简短信息:
我需要使用PHP(SOAP客户端)的WCF服务.它使用wsHttpBinding(ws-security),无法设置basicHttpBinding.一切都在VPN背后,所以我无法为您提供webservice的链接.此外,数据被视为机密(来自客户的请求),因此我无法向您提供完整信息,只能提供一些"常见"信息.这是WS配置:
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IServices" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" negotiateServiceCredential="true" algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://topSecert.url/Service.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IServices"
contract="IServices" name="WSHttpBinding_IServices" />
</client>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)
我的尝试:
1)基本的PHP Soap客户端不起作用.它总是挂起,直到达到最大执行时间(没有生成错误).我后来发现PHP Soap客户端不支持wsHttpBinding(想哭)
2)一些SoapClient扩展类但没有成功,请求仍然挂起.
3)使用SOAPAction头尝试"自生成"CURL请求.最后我得到了一些错误(我用wse类生成了请求):
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">http://www.w3.org/2005/08/addressing/soap/fault</a:Action>
</s:Header>
<s:Body>
<s:Fault>
<s:Code> …Run Code Online (Sandbox Code Playgroud)