Community
Participate
Working Groups
Build: 20020321 Description: I developed a benchmark to determine how long it takes to do a plaintext search in Eclipse. Effectively, my benchmark imports all of Eclipse as source, and then repeatedly searches for instances of the word 'for' in all available resources. I can only do the search about 12 times before I get an error message telling me to go look in the log file for further details. I did a system-wide search for this log file and found none. After checking my benchmark code a few times, I performed the test manually and came up with the same results. I lost track of how many searches it took to cause the error but I did eventually cause it. There are approximately 48,000 instances of 'for' in Eclipse. The first few times I ran the search, it found all 48,000 and it seemed to run reasonably quickly. The time that the search failed, it only found about 1,700 instances and the search ran very slowly. I dismissed the error and tried the search again. This time it found about 12,000 instances before failing the same way. I can't find a log file, or a core file, so I don't know what the exception was, and I don't have a stack trace. The problem does seem to be repeatable, though.
Possible reason which comes to mind: out of memory exception
Could you provide the benchmark? Could my comment point into the right direction?
This is in the org.eclipse.benchmarks in ottcvs1://home/cvs/desktop in the class TextSearchBenchmark. Here is the contents of the class. And yes I believe this was a result of an Out of Memory error as Search increases the siuze of the heap dramatically. package org.eclipse.benchmarks.search; import java.lang.reflect.Field; import org.eclipse.benchmarks.*; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.pde.core.plugin.IPluginModelBase; import org.eclipse.search.internal.ui.text.TextSearchPage; import org.eclipse.swt.widgets.*; public class TextSearchBenchmark extends Benchmark { private static final int ITERATIONS = 25; private Shell shell; /** * Constructor for TextSearchBenchmark. * @param testName */ public TextSearchBenchmark(String testName) { super(testName); } public void testTextSearch() throws Exception { Field searchPattern = TextSearchPage.class.getDeclaredField ("fPattern"); Field fileExtensions = TextSearchPage.class.getDeclaredField ("fExtensions"); searchPattern.setAccessible(true); fileExtensions.setAccessible(true); Combo pattern; Combo extensions; TextSearchPage page = new TextSearchPage(); SearchPageContainer container = new SearchPageContainer (this.shell, new StructuredSelection(), page); container.setBlockOnOpen(false); container.open(); pattern = (Combo)searchPattern.get(page); pattern.setText("for"); extensions = (Combo)fileExtensions.get(page); extensions.setText("*.*"); AggregateStopWatch watch = new AggregateStopWatch(ITERATIONS, 1, new String[] {"Time to search for 'for'"}); BenchmarkLogFile file = new BenchmarkLogFile(); file.addWatch(watch, watch.getDefaultHeader("TextSearch", "Time to search all of Eclipse for instances of 'for'")); file.prepareForCrash(); for(int i = 0; i < ITERATIONS; i++) { watch.startNewIteration(); page.performAction(); watch.stopIteration(); this.flushEventQueue(this.shell.getDisplay()); System.out.println(i + 1); } container.cancelPressed(); file.writeAsCSVTo(this.log); file.normalShutDown(); // MessageDialog.openInformation(this.shell, "Wait loop", "Look for some search results"); } public void setUp() throws Exception { super.setUp(); this.shell = this.fWorkbench.getActiveWorkbenchWindow().getShell (); IPluginModelBase[] models = BenchmarkPDEUtil.getAllModels(); BenchmarkPDEUtil.importModels(models, true); // BenchmarkPDEUtil.importModels(models, 0, Math.min(5, models.length), true); } }
see bug 16731 and bug 16732 (once these get fixed we can retry this scenario)
nope, these 2 are not related they are major , but show up only whan you close the search view, reopen, do search, close .... (basically, if you do search in a new view everytime) sorry for confusion i'm back to leak hunting...
more findings no leak in the following scenario: 1. text search 2. remove all search results however, repeated search is a problem because all previous searches are kept around objects of class Search are heavy-weighted - they have handles to many things so, repeated search, without clearing search results will eventually lead to OutOfMemory error
Since the history is kept search will run out of memory at some point. When I test it against 2.0 then an error dialog is shown which points you to the .log. The .log contains the OutOfMemoryError. This can happen to *all* our operations at some point: we normally don't catch OutOfMemoryError in our code to present a special dialog. This is a general platform issue: how do we handle out of memory and how is it presented to the user. Currently he is most likely lost: the VM is already out of memory and saving the workspace will fail. Core (along with Platform UI) should pre-allocate some memory, catch the OutOfMemoryException if not headless show a dialog to the user saying we're out of memory and then freeing the memory we allocated at the beginning, then save and exit the workspace. Moving to platform core for investigation of the general problem.
Old title: Internal Error after repeated search
*** This bug has been marked as a duplicate of 12224 ***