我们在生产中遇到问题已经有一段时间了......
这是以下内容的跟进:my other question但有更具体的方式,所以我认为将其作为一个新问题发布是合理的(如果不是,我只会将此信息添加到另一个问题)。
这里是:
因此,我们使用使用 cxf 的应用程序使用 (ibm) java 6 weblogic 在 aix 上发生文件描述符泄漏,我们解决了我们自己的 Web 服务以及路由到我们的 ws 的 jsb。
使用 File Leak Detector 时作为 weblogic 启动中的代理,转储 getCurrentOpenFiles() 并以编程方式过滤 Listener.SocketRecord,我们有 2000 多个打开的套接字;
这些是 java 套接字和文件描述符,网络套接字(使用 netstat 查看)按时间正确关闭,但是程序化套接字(以及使用查看的)
lsof -p $pid_of_managed_server 2> /dev/null|grep TCP|wc -l
)保持打开状态(并最终导致打开文件过多的问题))。
这是 jvm 中那些打开的文件描述符之一的栈的头部:
record socket to tst-cjcsr.com/10.239.7.19:443 by thread:[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)' on Thu Nov 10 10:25:56 CET 2016
at java.net.PlainSocketImpl.create(PlainSocketImpl.java:188)
at java.net.Socket.createImpl(Socket.java:411)
at java.net.Socket.connect(Socket.java:544)
at weblogic.net.http.HttpsClient.openWrappedSSLSocket(HttpsClient.java:565)
at weblogic.net.http.HttpsClient.openServer(HttpsClient.java:296)
at weblogic.net.http.HttpsClient.openServer(HttpsClient.java:373)
at weblogic.net.http.HttpsClient.New(HttpsClient.java:528)
at weblogic.net.http.HttpsURLConnection.connect(HttpsURLConnection.java:239)
at weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:409)
at weblogic.net.http.SOAPHttpsURLConnection.getInputStream(SOAPHttpsURLConnection.java:37)
at weblogic.net.http.HttpURLConnection.getResponseCode(HttpURLConnection.java:1038)
at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.getResponseCode(URLConnectionHTTPConduit.java:266)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.doProcessResponseCode(HTTPConduit.java:1550)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1579)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1520)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1317)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:632)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:572)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:481)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:382)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:335)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:136)
at com.sun.proxy.$Proxy380.requestOurRecord(Unknown Source)
at some.package.application.dossier.DossierBean$1.call(DossierBean.java:225)
我可以想象这是一个应用问题,因为我在网上找不到其他类似缺陷的案例。
有没有人能从这个堆栈中得到更多的意义?
例如:令我感到奇怪的是 HTTPConduit.close() 想要创建一个连接...
还有一点: 非 https 调用的相同技术堆栈不会出现此问题。 (这确实有意义,因为堆栈跟踪提到了 HttpsClient)
CXF版本:2.7.18
cxf 配置:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:soap="http://cxf.apache.org/bindings/soap"
xmlns:cxf="http://cxf.apache.org/core"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<context:property-placeholder location="file:${config.file.location}cjr-extract-${environment}.properties"/>
<jaxws:client id="OurService"
serviceClass="some.package.ws.extract.generated.OurService"
address="${ws.extract.wsdl.endpoint}">
<jaxws:binding>
<soap:soapBinding version="1.2"/>
</jaxws:binding>
</jaxws:client>
<cxf:bus>
<cxf:outInterceptors>
<bean class="our.package.interceptors.SomeInterceptor"
id="webSecurityInterceptor">
<constructor-arg>
<map>
<entry key="action" value="Timestamp Signature"/>
<entry key="user" value="${org.apache.ws.security.crypto.merlin.keystore.alias}"/>
<entry key="passwordCallbackRef">
<ref bean="passwordCallBack"/>
</entry>
<!--entry key="signaturePropFile" value="properties/our.properties"/-->
<entry key="signaturePropFile" value="file:${location}/our.properties"/>
<entry key="signatureKeyIdentifier" value="DirectReference" />
</map>
</constructor-arg>
</bean>
</cxf:outInterceptors>
<cxf:properties>
<entry key="signatureParts"
value="{Element}{http://www.w3.org/2003/05/soap-envelope}Body;{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp"/>
</cxf:properties>
</cxf:bus>
<bean id="passwordCallBack" class="our.package.authentication.PasswordCallbackHandler">
<property name="password" value="${password}"/>
<property name="alias" value="${org.apache.ws.security.crypto.merlin.keystore.alias}"/>
</bean>
</beans>
Java:
java version "1.6.0"
Java(TM) SE Runtime Environment (build pap3260sr15fp1-20140110_01(SR15 FP1))
IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 AIX ppc-32 jvmap3260sr15-
20131231_180656 (JIT enabled, AOT enabled)
J9VM - 20131231_180656
JIT - r9_20130920_46510ifx3
GC - GA24_Java6_SR15_20131231_1152_B180656)
JCL - 20140107_01
网络逻辑 10.3.6
感谢提示、指点,当然还有 - 如果可能的话 - 回答 ;-)
S.
EJP 请求代码,这里是:
调用本身:
private OurService ourservice;
private Callable<RequestOurRecordResponse> callService(final RequestOurRecordRequest request) {
return new Callable<RequestOurRecordResponse>() {
@Override
public RequestOurRecordResponse call() throws Exception {
try {
return ourService.requestOurRecord(request); // this is line 225.
} catch (Exception e) {
facesMessages.error("technicalError");
log.error("Encountered technical error", e);
return null;
}
}
};
}
生成的网络服务:
package some.package.ws.extract.generated;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.1.7-b01-
* Generated source version: 2.1
*
*/
@WebService(name = "OurService", targetNamespace = "http://secret/service-v1.0-rc2")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@XmlSeeAlso({
ObjectFactory.class
})
public interface OurService {
/**
*
* @param requestOurRecordRequest
* @return
* returns some.package.ws.extract.generated.RequestOurRecordResponse
*/
@WebMethod(action = "http://secret/service/RequestOurRecord")
@WebResult(name = "requestOurRecordResponse", targetNamespace = "http://secret/service-v1.0-rc2", partName = "requestOurRecordResponse")
public RequestOurRecordResponse requestOurRecord(
@WebParam(name = "requestOurRecordRequest", targetNamespace = "http://secret/service-v1.0-rc2", partName = "requestOurRecordRequest")
RequestOurRecordRequest requestOurRecordRequest);
}
与:
<http-conf:conduit name="*.http-conduit">
<http-conf:client Connection="Close" />
</http-conf:conduit>
连接(操作系统级别)关闭;但我们仍然有泄漏(上述行为)。
与:
<http-conf:conduit name="*.http-conduit">
<http-conf:client Connection="Keep-Alive" />
</http-conf:conduit>
作为文件描述符的连接(操作系统级别)都在不断上升......
(附加信息:操作系统级别的连接断开(我猜是在超时之后)但文件描述符保持打开状态...)
最佳答案
从我的角度来看,问题与 cxf 配置有关,也许 weblogic + cxf 的相互作用也是一个问题,因为管理连接的是 cxf 组件(请参阅堆栈跟踪)。所以我建议尝试使用不同的保持 Activity 设置(描述了如何设置保持 Activity 状态 here )。不过,这似乎无助于击败打开的文件描述符。
更新:
在对你的问题进行更多思考之后:
at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.getResponseCode(URLConnectionHTTPConduit.java:266)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.doProcessResponseCode(HTTPConduit.java:1550)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1579)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1520)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1317)
似乎在关闭 http 连接时,cxf 试图取回一些响应代码并为此创建一个套接字,因为这些套接字只是等待永远不会无限期出现的响应,从而造成泄漏。整个流程描述here在简化的客户端工作流程部分下。那么,下一个问题是,tst-cjcsr.just.fgov.be 会回复吗?而且,我的下一个建议是为 http-conf:client 配置 ReceiveTimeout,如 link 中所述。以上。
关于java - 获取响应代码时文件描述符泄漏。 (cxf, ssl),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40529499/
作为我的Rails应用程序的一部分,我编写了一个小导入程序,它从我们的LDAP系统中吸取数据并将其塞入一个用户表中。不幸的是,与LDAP相关的代码在遍历我们的32K用户时泄漏了大量内存,我一直无法弄清楚如何解决这个问题。这个问题似乎在某种程度上与LDAP库有关,因为当我删除对LDAP内容的调用时,内存使用情况会很好地稳定下来。此外,不断增加的对象是Net::BER::BerIdentifiedString和Net::BER::BerIdentifiedArray,它们都是LDAP库的一部分。当我运行导入时,内存使用量最终达到超过1GB的峰值。如果问题存在,我需要找到一些方法来更正我的代
如何在buildr项目中使用Ruby?我在很多不同的项目中使用过Ruby、JRuby、Java和Clojure。我目前正在使用我的标准Ruby开发一个模拟应用程序,我想尝试使用Clojure后端(我确实喜欢功能代码)以及JRubygui和测试套件。我还可以看到在未来的不同项目中使用Scala作为后端。我想我要为我的项目尝试一下buildr(http://buildr.apache.org/),但我注意到buildr似乎没有设置为在项目中使用JRuby代码本身!这看起来有点傻,因为该工具旨在统一通用的JVM语言并且是在ruby中构建的。除了将输出的jar包含在一个独特的、仅限ruby
在rails源中:https://github.com/rails/rails/blob/master/activesupport/lib/active_support/lazy_load_hooks.rb可以看到以下内容@load_hooks=Hash.new{|h,k|h[k]=[]}在IRB中,它只是初始化一个空哈希。和做有什么区别@load_hooks=Hash.new 最佳答案 查看rubydocumentationforHashnew→new_hashclicktotogglesourcenew(obj)→new_has
我真的很习惯使用Ruby编写以下代码:my_hash={}my_hash['test']=1Java中对应的数据结构是什么? 最佳答案 HashMapmap=newHashMap();map.put("test",1);我假设? 关于java-等价于Java中的RubyHash,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/22737685/
有没有办法在这个简单的get方法中添加超时选项?我正在使用法拉第3.3。Faraday.get(url)四处寻找,我只能先发起连接后应用超时选项,然后应用超时选项。或者有什么简单的方法?这就是我现在正在做的:conn=Faraday.newresponse=conn.getdo|req|req.urlurlreq.options.timeout=2#2secondsend 最佳答案 试试这个:conn=Faraday.newdo|conn|conn.options.timeout=20endresponse=conn.get(url
我是Google云的新手,我正在尝试对其进行首次部署。我的第一个部署是RubyonRails项目。我基本上是在关注thisguideinthegoogleclouddocumentation.唯一的区别是我使用的是我自己的项目,而不是他们提供的“helloworld”项目。这是我的app.yaml文件runtime:customvm:trueentrypoint:bundleexecrackup-p8080-Eproductionconfig.ruresources:cpu:0.5memory_gb:1.3disk_size_gb:10当我转到我的项目目录并运行gcloudprevie
我的主要目标是能够完全理解我正在使用的库/gem。我尝试在Github上从头到尾阅读源代码,但这真的很难。我认为更有趣、更温和的踏脚石就是在使用时阅读每个库/gem方法的源代码。例如,我想知道RubyonRails中的redirect_to方法是如何工作的:如何查找redirect_to方法的源代码?我知道在pry中我可以执行类似show-methodmethod的操作,但我如何才能对Rails框架中的方法执行此操作?您对我如何更好地理解Gem及其API有什么建议吗?仅仅阅读源代码似乎真的很难,尤其是对于框架。谢谢! 最佳答案 Ru
我有一个存储主机名的Ruby数组server_names。如果我打印出来,它看起来像这样:["hostname.abc.com","hostname2.abc.com","hostname3.abc.com"]相当标准。我想要做的是获取这些服务器的IP(可能将它们存储在另一个变量中)。看起来IPSocket类可以做到这一点,但我不确定如何使用IPSocket类遍历它。如果它只是尝试像这样打印出IP:server_names.eachdo|name|IPSocket::getaddress(name)pnameend它提示我没有提供服务器名称。这是语法问题还是我没有正确使用类?输出:ge
我想获取模块中定义的所有常量的值:moduleLettersA='apple'.freezeB='boy'.freezeendconstants给了我常量的名字:Letters.constants(false)#=>[:A,:B]如何获取它们的值的数组,即["apple","boy"]? 最佳答案 为了做到这一点,请使用mapLetters.constants(false).map&Letters.method(:const_get)这将返回["a","b"]第二种方式:Letters.constants(false).map{|c
我的假设是moduleAmoduleBendend和moduleA::Bend是一样的。我能够从thisblog找到解决方案,thisSOthread和andthisSOthread.为什么以及什么时候应该更喜欢紧凑语法A::B而不是另一个,因为它显然有一个缺点?我有一种直觉,它可能与性能有关,因为在更多命名空间中查找常量需要更多计算。但是我无法通过对普通类进行基准测试来验证这一点。 最佳答案 这两种写作方法经常被混淆。首先要说的是,据我所知,没有可衡量的性能差异。(在下面的书面示例中不断查找)最明显的区别,可能也是最著名的,是你的