geosolutions-it / mapfish-print

A component of http://www.mapfish.org for printing templated cartographic maps. This module is the java serverside module. It works well with the mapfish print javascript module.
http://www.mapfish.org/doc/print/
GNU General Public License v3.0
3 stars 9 forks source link

Native Thread Leak causes out of memory #18

Open offtherailz opened 10 years ago

offtherailz commented 10 years ago

The out of memory error like this:

The GeoServer log notifies:

            java.lang.OutOfMemoryError: unable to create new native thread

In the standard output of your jvm you can also find some errors like:

            SEVERE: A web application appears to have started a thread named [Batik CleanerThread] but has failed to stop it. This is very likely to create a memory leak.

Basically the MapFish print and the related plugin of GeoServer create a thread pool for every pdf generation request, and it doesn't dispose these threads after the print process end.

offtherailz commented 10 years ago

To avoid this problem, we found a workaround: Add this 2 lines to your config.yaml

globalParallelFetches: 1
perHostParallelFetches: 1

basically it tells to MapFish to do not create the thread pool. Obviously this change will slow down the pdf creation, but can avoid the jvm out of memory problem.