Sun的Java SSL实现是否泄漏内存? [英] Sun's Java SSL Implementation is Leaking Memory?
问题描述
我有一个服务器组件,我正在尝试加载测试。与服务器的所有连接都使用TLS 1.0。我有一个简单的测试程序,基本上可以在我想要的多个线程上执行此操作:
I have a server component that I'm trying to load-test. All connections to the server use TLS 1.0. I have a simple test program that essentially does this on as many threads as I want:
Full TLS handshake to the server
send a request
read reply
close connection
repeat ad nauseam
我的虚拟机如下:
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) Server VM (build 14.2-b01, mixed mode)
我有内存泄漏。当我对我的服务器进行大量测试时,我的内存占用量增加了大约1兆比特,这使得它在15-20分钟后因 OutOfMemoryException
而被阻止。
I have a memory leak. My memory footprint increases by about 1 meg per second when I heavily test my server, which makes it block after 15-20 minutes with OutOfMemoryException
.
我在Netbean的分析器中运行它,它表明内存的增加深入TLS API。
I ran it in Netbean's profiler and it showed that the increase of memory was deep within the TLS API.
有没有人经历过类似的事情?我可以在我的级别实施任何解决方法吗?
Has anyone ever experienced something similar? Is there any workaround I can implement at my level?
编辑。根据要求,这里是分析调用跟踪,它生成了很多这些byte []:
Edit. As requested, here's the profiling call trace which generates a lot of these byte[]:
.java.io.ByteArrayOutputStream.<init>(int)
..com.sun.net.ssl.internal.ssl.OutputRecord.<init>(byte, int)
...com.sun.net.ssl.internal.ssl.OutputRecord.<init>(byte)
....com.sun.net.ssl.internal.ssl.AppOutputStream.<init>(com.sun.net.ssl.internal.ssl.SSLSocketImpl)
.....com.sun.net.ssl.internal.ssl.SSLSocketImpl.init(com.sun.net.ssl.internal.ssl.SSLContextImpl, boolean)
......com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>(com.sun.net.ssl.internal.ssl.SSLContextImpl, java.net.Socket, String, int, boolean)
.......com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(java.net.Socket, String, int, boolean)
<my code>
还有很多我可以放的......这会很长。我会告诉你分析器给我的切入点:
There are many more I can put... this would be long. I'll tell you the entry points that the profiler gives me:
....com.sun.net.ssl.internal.ssl.AppOutputStream.<init>(com.sun.net.ssl.internal.ssl.SSLSocketImpl)
....com.sun.net.ssl.internal.ssl.HandshakeOutStream.<init>(com.sun.net.ssl.internal.ssl.ProtocolVersion, com.sun.net.ssl.internal.ssl.ProtocolVersion, com.sun.net.ssl.internal.ssl.HandshakeHash, com.sun.net.ssl.internal.ssl.SSLSocketImpl)
....com.sun.net.ssl.internal.ssl.SSLSocketImpl.sendAlert(byte, byte)
..com.sun.net.ssl.internal.ssl.AppInputStream.<init>(com.sun.net.ssl.internal.ssl.SSLSocketImpl)
..com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake()
..com.sun.net.ssl.internal.ssl.HandshakeInStream.<init>(com.sun.net.ssl.internal.ssl.HandshakeHash)
推荐答案
您是否看到了连接关闭。很可能这仍然以某种方式开放。 1Mb是一些额外的线程。但是,我不确定究竟是什么原因。
Have u seen the connection close. Most likely this is still open somehow. 1Mb is a sing of some extra thread. However, I am not sure what exactly would be the reason.
这篇关于Sun的Java SSL实现是否泄漏内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!