https://issues.apache.org/bugzilla/show_bug.cgi?id=50685
Summary: Big memory leak
Product: Tomcat 7
Version: 7.0.6
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: major
Priority: P2
Component: Catalina
AssignedTo: [email protected]
ReportedBy: [email protected]
1) Download apache-tomcat-7.0.6-windows-x86.zip and unzip to
C:\apache-tomcat-7.0.6 . But this bug with all tomcat versions.
2) Create simple jsp C:\apache-tomcat-7.0.6\webapps\ROOT\test.jsp :
AAA<%=7+8%>
3) Add SET JAVA_HOME=C:\Program Files\Java\jdk1.6.0_23\ to
C:\apache-tomcat-7.0.6\bin\startup.bat and run startup.bat
4) Open http://localhost:8080/test.jsp in browser - it works and shows AAA15.
5) Do 100000 requests to http://localhost:8080/test.jsp. Create new c# windows
forms app. Put one button with code:
private void button1_Click(object sender, EventArgs e)
{
StringBuilder sb = new StringBuilder();
byte[] buf = new byte[8192];
for (int i = 0; i < 100000; i++)
{
HttpWebRequest request =
(HttpWebRequest)WebRequest.Create("http://localhost:8080/test.jsp");
using(HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (Stream resStream = response.GetResponseStream())
{
string tempString = null; int count = 0;
count = resStream.Read(buf, 0, buf.Length);
if (count != 0) tempString = Encoding.ASCII.GetString(buf, 0, count);
}
}
}
6) It takes 15 seconds - test success. But tomcat process java.exe used 5mb
memory before test, after test 270mb. If run test again java.exe take 286mb and
crashed: Exception in thread ""http-apr-8080"-exec-2"
java.lang.OutOfMemoryError: Java heap space ....
7) run MemoryAnalyzer. It shows 2 problem:
One instance of "org.apache.catalina.session.StandardManager" loaded by
"org.apache.catalina.loader.StandardClassLoader @ 0x7f00638" occupies 3,112,280
(56.61%) bytes. The memory is accumulated in one instance of
"java.util.concurrent.ConcurrentHashMap$HashEntry[]" loaded by "<system class
loader>".
The classloader/component "org.apache.catalina.loader.StandardClassLoader @
0x7f00638" occupies 637,728 (11.60%) bytes. The memory is accumulated in one
instance of "java.lang.Object[]" loaded by "<system class loader>".
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]