fasten icon indicating copy to clipboard operation
fasten copied to clipboard

Java REST API crashes due to the out of memory exception

Open mir-am opened this issue 2 years ago • 2 comments

Describe the bug

The REST API is completely unresponsive when it's just launched. A simple query like http://localhost/packages does not work.

Logs

2022-06-07 10:08:21.062 DEBUG 1 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Failed to complete request: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'resolutionApi' defined in URL [jar:file:/app/rest-api.jar!/BOOT-INF/classes!/eu/fasten/analyzer/restapiplugin/api/ResolutionApi.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [eu.fasten.analyzer.restapiplugin.api.ResolutionApi]: Constructor threw exception; nested exception is java.lang.OutOfMemoryError: Java heap space
2022-06-07 10:08:21.068 ERROR 1 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'resolutionApi' defined in URL [jar:file:/app/rest-api.jar!/BOOT-INF/classes!/eu/fasten/analyzer/restapiplugin/api/ResolutionApi.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [eu.fasten.analyzer.restapiplugin.api.ResolutionApi]: Constructor threw exception; nested exception is java.lang.OutOfMemoryError: Java heap space] with root cause

java.lang.OutOfMemoryError: Java heap space

Environment (please complete the following information):

  • OS: Ubuntu 18.04
  • Java version: 11

mir-am avatar Jun 07 '22 11:06 mir-am

Right now, it tries to instantiate the MavenResolver, which likely has issues with the new DB size. How much memory does the REST API have at the moment? Until we factor out the resolution to the micro-service, the REST API should have at least 32GB, if not more by now.

proksch avatar Jun 07 '22 15:06 proksch

To give an update, with 64 GB of the heap size, the REST API still crashes. See:

$ kubectl top pod -n fasten fasten-restapi-java-5bcb74b56d-tsbv8
NAME                                   CPU(cores)   MEMORY(bytes)   
fasten-restapi-java-5bcb74b56d-tsbv8   561m         63934Mi

mir-am avatar Jun 08 '22 09:06 mir-am