[Geoserver-devel] [jira] (GEOS-6912) Memory leak (SchemaCleanerCallback finalize not called before thread ends)

Jerry Wilwerding created an issue

GeoServer / BugGEOS-6912

Memory leak (SchemaCleanerCallback finalize not called before thread ends)

Issue Type:

BugBug

Affects Versions:

2.7-beta, 2.5.1

Assignee:

Rini Angreani

Components:

Application schema, WFS

Created:

25/Feb/15 4:36 PM

Priority:

MajorMajor

Reporter:

Jerry Wilwerding

Repeated requests for XSLT transformations leveraging the app-schemas will eventually run tomcat out of memory.

When a request is made, org.geoserver.ows.Dispatcher runs in a thread.

The Dispatcher thread will create a NEW thread in XSLTOutputFormat with this code:
Future<Void> future = executor.submit(new Callable<Void>()

{ line 198 2.5.1}

In the newly created thread, FeatureTypeSchemaBuilder is eventually called. The build method will store the schema that was just
created in the SchemaCleanerCallback class. This class has a static ThreadLocal variable to hold the schema reference.
Since it is a ThreadLocal variable, only this new thread will have access to the schemas created.

The new thread returns back to the Dispatcher thread without calling the SchemaCleanerCallback finalize method causing the leak.

Dispatcher thread calls fireFinishedCallback which does call the SchemaCleanerCallback finalize method, but fails to clean up the schema since the ThreadLocal with the schema variable is not visible in the Dispatcher thread.

Recommend that all ThreadLocal instances used for memory management following the Callback pattern similar to SchemaCleanerCallback be analyzed to determine if this same error might also cause other leaks.

Add Comment

Add Comment

This message was sent by Atlassian JIRA (v6.1.6#6162-sha1:7af547c)

Atlassian logo