-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Ilya,
Oops, I see that the script will be loaded immediately by the browser. I
was expecting to see an XMLHttpRequest in there somewhere.
Can you post a segment of your access log that you get when you first
load this page?
- -chris
On 1/12/2011 5:08 PM, ilya goberman wrote:
>
> Greetings,
> Today I have encountered a nasty memory leak problem with Tomcat 7.0.4. The problem does
not exist in Tomcat 6.
> This is the most basic Servlet functionality. Can someone confirm it is broken?
>
> I wrote a simple Servlet that sends data. The client just makes the call to the Servlet
and issues a new call when the current call has completed. So it essentially calls the Servlet
in the loop.
> After running it for a minute, Tomcat generates a message:
>
> Jan 12, 2011 3:59:55 PM org.apache.tomcat.util.net.NioEndpoint$SocketProcessor run
> SEVERE:
> java.lang.OutOfMemoryError: Java heap space
> at org.apache.tomcat.util.buf.CharChunk.allocate(CharChunk.java:119)
> at org.apache.tomcat.util.buf.CharChunk.<init>(CharChunk.java:83)
> at org.apache.catalina.connector.InputBuffer.<init>(InputBuffer.java:162)
> at org.apache.catalina.connector.InputBuffer.<init>(InputBuffer.java:146)
> at org.apache.catalina.connector.Request.<init>(Request.java:252)
> at org.apache.catalina.connector.Connector.createRequest(Connector.java:795)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)
> at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:386)
> at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:373)
> at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1526)
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:619)
> Jan 12, 2011 3:59:55 PM org.apache.tomcat.util.net.NioEndpoint checkParachute
> SEVERE: SEVERE:Memory usage is low, parachute is non existent, your system may start
failing.
> Jan 12, 2011 3:59:55 PM org.apache.tomcat.util.net.NioEndpoint checkParachute
> SEVERE: SEVERE:Memory usage is low, parachute is non existent, your system may start
failing.
>
> The Servlet code is below:
>
> public class WebFrameworkServletScriptStreaming extends HttpServlet {
>
> public void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
> response.setHeader("pragma", "no-cache,no-store");
> response.setHeader("cache-control", "no-cache,no-store,max-age=0,max-stale=0");
>
> response.setContentType("text/json");
>
> PrintWriter out = response.getWriter();
>
> for (int i = 0; i < 1000; i++) {
> out.print("push('{\"foo\":\"bar\"}');");
> }
> }
> }
>
> This is the client - use FF:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
> <html>
> <head>
> <title>test</title>
> </head>
> <body">
> <input type="button" value="TEST" onclick="test(); return false;" />
>
> <script type="text/javascript">
> var id = 0;
>
> function test() {
> var head = document.getElementsByTagName('head')[0];
> var script = document.createElement('script');
> script.type = 'text/javascript';
> script.onreadystatechange = function () {
> };
> script.onload = function () {
> head.removeChild(script);
> // LOOP!!!
> test();
> };
> script.onerror = function () {
> head.removeChild(script);
> };
> script.src = 'http://172.16.16.250/Test/Controller?test=' + (id++);
> head.appendChild(script);
> }
>
> function push(json) {
> }
>
> </script>
>
> </body>
> </html>
>
>
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk0uLU4ACgkQ9CaO5/Lv0PAUOgCdGsTcLGaNZEd74NELtlbkLt7n
3x4AoIkZ1+iwQyLlJF6Vq5fIpJzgSItm
=1kRM
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
|