Community
Participate
Working Groups
reproducible: always java.lang.OutOfMemoryError: Requested array size exceeds VM limit (failed to allocate 17179869200 bytes) (array length 2147483647)| at org.apache.lucene.util.PriorityQueue.initialize(PriorityQueue.java:105)| at org.apache.lucene.search.HitQueue.<init>(HitQueue.java:67)| at org.apache.lucene.search.TopScoreDocCollector.<init>(TopScoreDocCollector.java:126)| at org.apache.lucene.search.TopScoreDocCollector.<init>(TopScoreDocCollector.java:37)| at org.apache.lucene.search.TopScoreDocCollector$OutOfOrderTopScoreDocCollector.<init>(TopScoreDocCollector.java:74)| at org.apache.lucene.search.TopScoreDocCollector$OutOfOrderTopScoreDocCollector.<init>(TopScoreDocCollector.java:72)| at org.apache.lucene.search.TopScoreDocCollector.create(TopScoreDocCollector.java:115)| at org.eclipse.skalli.core.internal.search.LuceneIndex.search(LuceneIndex.java:341)| at org.eclipse.skalli.core.internal.search.LuceneIndex.search(LuceneIndex.java:307)| at org.eclipse.skalli.core.internal.search.SearchServiceImpl.findProjectsByQuery(SearchServiceImpl.java:94)| at org.eclipse.skalli.api.rest.internal.resources.ProjectsResource.retrieve(ProjectsResource.java:48)| … Server process shutting down with exit code [666]; memory allocation error [OutOfMemoryError]|
Lucene seems not prepared to accept count=Integer.MAX_VALUE for search queries in org.eclipse.skalli.api.rest.internal.resources.ProjectsResource
https://issues.apache.org/jira/browse/LUCENE-504 org.apache.lucene.util.PriorityQueue allocates an Object array with maxSize entries in advance even if the result set is much smaller than maxSize. Incredible waste of memory, but the way TopScoreDocCollector is implemented, it seems to be inevitable. I'm going to add the "start" and "count" query parms for /api/projects?query=foobar so that one can retrieve search hits "page by page" like in the UI. Furthermore, I will limit "count" to the overall number of projects since it is impossible to have more search hits.
Created attachment 207720 [details] proposed patch
Created attachment 207777 [details] proposed patch (fixed invalid schema)
commited as http://git.eclipse.org/c/skalli/org.eclipse.skalli.git/commit/?id=471d19c42b5296f4f80e278b2b44f30eecf6a37c