"Zip Search" leads to fully dysfunctional Eclipse which can only be killed.
Run Zip Search on a directory containing a lot of zip / jar files (e.g. Eclipse installation or file root).
Sooner or later (in our case immediately) Eclipse stops to work and depending on which jar is affected, can't be properly closed anymore.
The reason is that zip search eagerly opens as many file inputs as it can find but (at least on Linux) the number of opened file descriptors is limited per process - if this limit (ulimit -n == 1024 on RHEL 7.4) is hit , Eclipse can'T open any file anymore. This is especially tragical because the OSGI can't load classes from jar bundles, resulting in random class not found errors and almost everything broken.
I have a patch.
!ENTRY org.eclipse.core.contenttype 4 0 2019-04-10 11:26:15.516 !MESSAGE FrameworkEvent ERROR !STACK 0 java.io.IOException: Exception in opening zip file: /tmp/test/plugins/org.eclipse.core.contenttype_3.7.100.v20180817-1401.jar at org.eclipse.osgi.framework.util.SecureAction.getZipFile(SecureAction.java:324) at org.eclipse.osgi.storage.bundlefile.ZipBundleFile.getZipFile(ZipBundleFile.java:136) at org.eclipse.osgi.storage.bundlefile.ZipBundleFile.lockOpen(ZipBundleFile.java:83) at org.eclipse.osgi.storage.bundlefile.ZipBundleFile.getEntry(ZipBundleFile.java:290) at org.eclipse.osgi.internal.loader.classpath.ClasspathEntry.findEntry(ClasspathEntry.java:194) at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findClassImpl(ClasspathManager.java:608) at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClassImpl(ClasspathManager.java:594) at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClassImpl(ClasspathManager.java:574) at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:553) at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:331) at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:395) at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:473) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:414) at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:153) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.eclipse.core.internal.content.ContentType.invalidateDescriber(ContentType.java:516) at org.eclipse.core.internal.content.ContentTypeCatalog.describe(ContentTypeCatalog.java:274) at org.eclipse.core.internal.content.ContentTypeCatalog.collectMatchingByContents(ContentTypeCatalog.java:241) at org.eclipse.core.internal.content.ContentTypeCatalog.internalFindContentTypesFor(ContentTypeCatalog.java:455) at org.eclipse.core.internal.content.ContentTypeCatalog.internalFindContentTypesFor(ContentTypeCatalog.java:514) at org.eclipse.core.internal.content.ContentTypeCatalog.getDescriptionFor(ContentTypeCatalog.java:398) at org.eclipse.core.internal.content.ContentTypeCatalog.getDescriptionFor(ContentTypeCatalog.java:412) at org.eclipse.core.internal.content.ContentTypeMatcher.getDescriptionFor(ContentTypeMatcher.java:82) at org.eclipse.core.internal.resources.ContentDescriptionManager.readDescription(ContentDescriptionManager.java:455) at org.eclipse.core.internal.resources.ContentDescriptionManager.getDescriptionFor(ContentDescriptionManager.java:364) at org.eclipse.core.internal.resources.File.getContentDescription(File.java:266) at zipeditor.search.ZipSearchQuery.addFile(ZipSearchQuery.java:150) at zipeditor.search.ZipSearchQuery.access$0(ZipSearchQuery.java:149) at zipeditor.search.ZipSearchQuery$1.visit(ZipSearchQuery.java:142) at org.eclipse.core.internal.resources.Resource.lambda$1(Resource.java:117) at org.eclipse.core.internal.resources.Resource.lambda$0(Resource.java:85) at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:85) at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:90) at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:90) at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:90) at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:90) at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:90) at org.eclipse.core.internal.watson.ElementTreeIterator.iterate(ElementTreeIterator.java:127) at org.eclipse.core.internal.resources.Resource.accept(Resource.java:94) at org.eclipse.core.internal.resources.Resource.accept(Resource.java:55) at org.eclipse.core.internal.resources.Resource.accept(Resource.java:117) at org.eclipse.core.internal.resources.Resource.accept(Resource.java:110) at zipeditor.search.ZipSearchQuery.getModelsFromResource(ZipSearchQuery.java:134) at zipeditor.search.ZipSearchQuery.getModelsFromElements(ZipSearchQuery.java:113) at zipeditor.search.ZipSearchQuery.run(ZipSearchQuery.java:162) at org.eclipse.search2.internal.ui.InternalSearchUI$InternalSearchJob.run(InternalSearchUI.java:95) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) Caused by: java.io.FileNotFoundException: /tmp/test/plugins/org.eclipse.core.contenttype_3.7.100.v20180817-1401.jar (Too many open files) at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(ZipFile.java:225) at java.util.zip.ZipFile.<init>(ZipFile.java:155) at java.util.zip.ZipFile.<init>(ZipFile.java:169) at org.eclipse.osgi.framework.util.SecureAction.getZipFile(SecureAction.java:307) ... 47 more
Patch: https://github.com/iloveeclipse/zipeditor/commit/4d4b585eb38464d5120f55685670c664344db1c1
Hi Andrey,
I see, your patch opens the input stream at a later point in time which in summary leads to lesser files opened at the same time.
I will take this over and prepare a new release within the next weeks.
Thanks,
Uwe