WEB-server tomcat 9.0 works for 2-3 minutes and falls. In this case, the OutOfMemoryError error appears and absolutely all the allocated RAM for the application is used. I only appeal to the server - one client. Information for transmission not more than 100kb per request.

Works server on Windows 7 x32.

There are 4 servlets (doGet) running on the server that collect information about the device with the help of a class object and transfer it to .JSP.

  1. In 'catalina.propirties' I registered'org.apache.jasper.runtime.JspFactoryImpl.USE_POOL = false';
  2. Zero variables after transferring data to JSP. Zeroed variables after use in the JSP itself;
  3. Called System.gc () to force garbage collection;
  4. In 'web.xml' added a parameter to servlets: 'enablePool = false';
  5. 'In context.xml' added 'cachingAllowed = "false"'

None of this fixed the problem.

The profiler indicates a large number of Strin and Char elements, but all elements should be reset to zero after use on the server.

Where to look for a problem?

  • DB is used in the application? There may be a leak in the JDBC pool. Maybe looping somewhere in the very logic of the application (for example, recursion function call) - Chubatiy
  • DB I do not use. I use a class that accesses network equipment via SNMP, we get an array of data, we transfer it to JSP. There are no loops except foreach in JSP itself. The growth of RAM consumed occurs once per request, then it simply does not clear it. So until the next request - Alex
  • one
    Try adding the <%@page session="false"%> at the top (there was a case when we didn’t have a session on pages and it was overflow) - Chubatiy
  • Did not help a jot. Can you recommend any tool to identify the problem? - Alex
  • one
    And how much memory is used, what is the scale of the problem? The leak is most likely in your code. The reasons may be many. As a diagnostic option: run jvisualvm , make a heap dump there, then there is an opportunity to find N largest objects. The plus is that there you can see who refers to the object and to whom the object refers, i.e. you can find where your legs grow from. - Roman

1 answer 1

The problems were in my code. In a class that accessed SNMP network equipment and collected information. This opened a Listner (UDP) that was not closed by the garbage collector.

Added a Listner'a close function to the class - a memory leak is excluded.