Potential Memory leak
Received report about memory leak in HGQL v1.0.3 since UGQL is build on this version this issue could also occur in UGQL.
testing the issue
Created UnitTest that executes 200000 queries against a UGQL server with a LocalModelSPARQLService. Result is monitored manually.
Observations
- Memory usage is increasing over time
- Number of threads constantly increasing
Reasons
- Query execution creates thread pools for each request instead of using one global thread pool
- insufficient creation of Objects and Collections
Counter measures
- Fixed thread pool for each service and one global one (might be merged to simplify)
- Changed Sets to lists where possible
- Fixed redundant object creation
Result
- Number of Thread is now limited
- Memory usage is decreased (max 800 MB nearly constant for the last quarter of the test)
Open Issues
- Memory usage is still slowly increasing possible reasons are:
- Too many queries in a short period of time see https://jena.apache.org/documentation/tdb/faqs.html#does-fusekitdb-have-a-memory-leak
- Further test need to be done to isolate the issue
- Resources not closed/freed
- Too many queries in a short period of time see https://jena.apache.org/documentation/tdb/faqs.html#does-fusekitdb-have-a-memory-leak
- Server framework jaxrs has still increasing number of threads