mapfish-print icon indicating copy to clipboard operation
mapfish-print copied to clipboard

Memory leak in some cases

Open pvalsecc opened this issue 7 years ago • 5 comments

The profiler tends to show a huge amount of objects in relation with XML schema caches deep down within dependencies of GeoTools.

The suspect is a layer with a SLD and a filter:

...
            },{
                "type": "GML",
                "name": "zoom",
                "url": "http://mapserver/mapserv?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAMES=agri_parcels_print,agri_parcels_finished_print&FILTER=%28%3CFilter%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3Eid%3C/PropertyName%3E%3CLiteral%3E${exchangeProperty.parcelId}%3C/Literal%3E%3C/PropertyIsEqualTo%3E%3C/Filter%3E%29%28%3CFilter%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3Eid%3C/PropertyName%3E%3CLiteral%3E${exchangeProperty.parcelId}%3C/Literal%3E%3C/PropertyIsEqualTo%3E%3C/Filter%3E%29",
                "style": "no_display"
            }],
            "projection": "EPSG:2056",
            "rotation": 0
        },
        "scale": 80000,
        "style": {"style": '<?xml version="1.0" encoding="UTF8"?><StyledLayerDescriptor version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <NamedLayer><Name>no_display</Name><UserStyle><Title>Default Line</Title><FeatureTypeStyle></FeatureTypeStyle> </UserStyle> </NamedLayer></StyledLayerDescriptor>'}
    },
    "layout": "A4 portrait ${exchangeProperty.canton}"
}

The current, but very ugly work around is to add those to CATALINA_OPTS (works only if you have something restarting your web server):

-XX:GCTimeLimit=70 -XX:GCHeapFreeLimit=5  -XX:+ExitOnOutOfMemoryError

Some prints will fail, but the print at least restarts.

Example with restarts

pvalsecc avatar May 29 '18 11:05 pvalsecc

We noticed the same and analyzed it. It seems, that XCDElementDeclarationImpl objects add up. They are referenced through the schema in the GML (XSD) sigleton from the GeoTools and they reference to one another so they are never garbage collected. @FrediWeber

svavoi avatar Feb 26 '20 13:02 svavoi

Yeah, I've seen problems in that area too, but never really found the culprit. Can you create a ticket in geotools, please?

pvalsecc avatar Feb 26 '20 14:02 pvalsecc

@svavoi do you have some test data/layers that reproduce this problem that I can use? I am trying to dig into this. Thanks in advance

danduk82 avatar May 25 '20 12:05 danduk82

Hi Andrea. You can reproduce it with the batch prints of agridea.

Le 25 mai 2020 14:31:21 Andrea Borghi [email protected] a écrit :

@svavoi do you have some test data/layers that reproduce this problem that I can use? I am trying to dig into this. Thanks in advance— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

pvalsecc avatar May 25 '20 15:05 pvalsecc

@pvalsecc thanks for the hint ;)

danduk82 avatar May 26 '20 07:05 danduk82