josefmezera / h2database

Automatically exported from code.google.com/p/h2database
0 stars 0 forks source link

Memory-Leak in WebServer.java: "lastAccess from WebSession"-Bug #417

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Problem description:
When you call login.jsp very often (e.g. every 10 seconds, please don't ask why 
I did that^^) then the Java heap runs out of memory (e.g. hundreds of megabytes 
in 2-3 days).

WebServer.java - Method getSession() line 213-231:

Line 218
    Long last = (Long) session.get("lastAccess");
always returns null and so line 221
    sessions.remove(id);
will be never called.

The HashMap "sessions" grows and grows and the memory-leak is perfect.

The reason is that line 228
    session.lastAccess = System.currentTimeMillis();
writes the class variable lastAccess but line 218
    Long last = (Long) session.get("lastAccess");
reads the HashMap "map" which doesn't contain the key "lastAccess".

I think you know what to do to fix it :)

Original issue reported on code.google.com by DerMais...@gmail.com on 14 Aug 2012 at 9:54

GoogleCodeExporter commented 9 years ago
Hi,

Sure, I will fix this. Thanks for reporting the issue!

Regards,
Thomas

Original comment by thomas.t...@gmail.com on 29 Oct 2012 at 7:08

GoogleCodeExporter commented 9 years ago
Fixed in version 1.3.170

Original comment by thomas.t...@gmail.com on 30 Nov 2012 at 6:52