spring-attic / spring-ide

Spring Development Environment for Eclipse
299 stars 125 forks source link

Background processing performed by BeansJavaConfig$2.call dramatically increases workspace build time #286

Closed wilkinsona closed 6 years ago

wilkinsona commented 6 years ago

I've got Spring Boot's source mounted in Eclipse and have noticed that background processing performed beneath BeansJavaConfig$2.call(BeansJavaConfig.java:1) takes several minutes to complete. While it's in progress saving source, running tests, etc are all blocked making my IDE pretty much unusable. I'm using Spring IDE 3.9.4.201804120850-RELEASE.

I took four thread dumps during the minutes-long building of the workspace:

12:06:12

"Background Thread-3 (Spring IDE/3.9.4)" #2091 daemon prio=5 os_prio=31 tid=0x00007fbc3c4a9000 nid=0x193f3 runnable [0x0000700009169000]
   java.lang.Thread.State: RUNNABLE
        at java.lang.ClassLoader.findLoadedClass0(Native Method)
        at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:1038)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:406)
        - locked <0x000000079ba49258> (a org.springframework.ide.eclipse.core.java.FilteringURLClassLoader)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at org.springframework.boot.context.properties.bind.Binder$Context.streamSources(Binder.java:461)
        at org.springframework.boot.context.properties.bind.Binder.findProperty(Binder.java:313)
        at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:256)
        at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:221)
        at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:210)
        at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:166)
        at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:153)
        at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.getExcludeAutoConfigurationsProperty(AutoConfigurationImportSelector.java:223)
        at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.getExclusions(AutoConfigurationImportSelector.java:216)
        at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.selectImports(AutoConfigurationImportSelector.java:99)
        at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:547)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:185)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:308)
        at org.springframework.ide.eclipse.metadata.process.JdtConfigurationClassPostProcessor.postProcess(JdtConfigurationClassPostProcessor.java:88)
        at org.springframework.ide.eclipse.beans.core.internal.model.BeansJavaConfig$3.run(BeansJavaConfig.java:332)
        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
        at org.springframework.ide.eclipse.beans.core.internal.model.BeansJavaConfig.executePostProcessor(BeansJavaConfig.java:321)
        at org.springframework.ide.eclipse.beans.core.internal.model.BeansJavaConfig.access$5(BeansJavaConfig.java:319)
        at org.springframework.ide.eclipse.beans.core.internal.model.BeansJavaConfig$2.call(BeansJavaConfig.java:233)
        at org.springframework.ide.eclipse.beans.core.internal.model.BeansJavaConfig$2.call(BeansJavaConfig.java:1)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
        - <0x000000076033a6d8> (a java.util.concurrent.ThreadPoolExecutor$Worker)

12:07:08

"Background Thread-3 (Spring IDE/3.9.4)" #2091 daemon prio=5 os_prio=31 tid=0x00007fbc3c4a9000 nid=0x193f3 runnable [0x0000700009167000]
   java.lang.Thread.State: RUNNABLE
        at java.lang.Throwable.fillInStackTrace(Native Method)
        at java.lang.Throwable.fillInStackTrace(Throwable.java:783)
        - locked <0x00000007ab3fe1c8> (a java.lang.ClassNotFoundException)
        at java.lang.Throwable.<init>(Throwable.java:287)
        at java.lang.Exception.<init>(Exception.java:84)
        at java.lang.ReflectiveOperationException.<init>(ReflectiveOperationException.java:75)
        at java.lang.ClassNotFoundException.<init>(ClassNotFoundException.java:82)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:484)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
        at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
        - locked <0x00000007acb70880> (a org.springframework.ide.eclipse.core.java.FilteringURLClassLoader)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
        - locked <0x00000007acb745a0> (a org.springframework.ide.eclipse.core.java.FilteringURLClassLoader)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.getExcludeAutoConfigurationsProperty(AutoConfigurationImportSelector.java:222)
        at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.getExclusions(AutoConfigurationImportSelector.java:216)
        at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.selectImports(AutoConfigurationImportSelector.java:99)
        at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:547)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:185)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:308)
        at org.springframework.ide.eclipse.metadata.process.JdtConfigurationClassPostProcessor.postProcess(JdtConfigurationClassPostProcessor.java:88)
        at org.springframework.ide.eclipse.beans.core.internal.model.BeansJavaConfig$3.run(BeansJavaConfig.java:332)
        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
        at org.springframework.ide.eclipse.beans.core.internal.model.BeansJavaConfig.executePostProcessor(BeansJavaConfig.java:321)
        at org.springframework.ide.eclipse.beans.core.internal.model.BeansJavaConfig.access$5(BeansJavaConfig.java:319)
        at org.springframework.ide.eclipse.beans.core.internal.model.BeansJavaConfig$2.call(BeansJavaConfig.java:233)
        at org.springframework.ide.eclipse.beans.core.internal.model.BeansJavaConfig$2.call(BeansJavaConfig.java:1)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
        - <0x000000076033a6d8> (a java.util.concurrent.ThreadPoolExecutor$Worker)

12:13:10

"Background Thread-3 (Spring IDE/3.9.4)" #2091 daemon prio=5 os_prio=31 tid=0x00007fbc3c4a9000 nid=0x193f3 runnable [0x0000700009169000]
   java.lang.Thread.State: RUNNABLE
        at java.util.zip.ZipFile.getEntry(ZipFile.java:310)
        - locked <0x0000000757a60c68> (a java.util.jar.JarFile)
        at java.util.jar.JarFile.getEntry(JarFile.java:240)
        at java.util.jar.JarFile.getJarEntry(JarFile.java:223)
        at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:1042)
        at sun.misc.URLClassPath$JarLoader.findResource(URLClassPath.java:1020)
        at sun.misc.URLClassPath.findResource(URLClassPath.java:215)
        at java.net.URLClassLoader$2.run(URLClassLoader.java:569)
        at java.net.URLClassLoader$2.run(URLClassLoader.java:567)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findResource(URLClassLoader.java:566)
        at org.springframework.ide.eclipse.core.java.FilteringURLClassLoader.findResource(FilteringURLClassLoader.java:39)
        at java.lang.ClassLoader.getResource(ClassLoader.java:1096)
        at org.springframework.ide.eclipse.core.java.FilteringURLClassLoader.getResource(FilteringURLClassLoader.java:51)
        at java.lang.ClassLoader.getResource(ClassLoader.java:1091)
        at org.springframework.ide.eclipse.core.java.FilteringURLClassLoader.getResource(FilteringURLClassLoader.java:51)
        at java.net.URLClassLoader.getResourceAsStream(URLClassLoader.java:232)
        at org.springframework.ide.eclipse.core.java.FilteringURLClassLoader.getResourceAsStream(FilteringURLClassLoader.java:57)
        at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:166)
        at org.springframework.ide.eclipse.core.type.asm.SimpleClassReaderFactory.getClassReader(SimpleClassReaderFactory.java:67)
        at org.springframework.ide.eclipse.core.type.asm.CachingClassReaderFactory.getClassReader(CachingClassReaderFactory.java:61)
        - locked <0x0000000782889340> (a java.util.HashMap)
        at org.springframework.ide.eclipse.core.type.asm.SimpleClassReaderFactory.getClassReader(SimpleClassReaderFactory.java:63)
        at org.springframework.ide.eclipse.core.java.classreading.JdtConnectedMetadataReader.<init>(JdtConnectedMetadataReader.java:44)
        at org.springframework.ide.eclipse.core.java.classreading.JdtMetadataReaderFactory.getMetadataReader(JdtMetadataReaderFactory.java:53)
        at org.springframework.ide.eclipse.core.java.classreading.CachingJdtMetadataReaderFactory.getMetadataReader(CachingJdtMetadataReaderFactory.java:38)
        - locked <0x00000007828893e0> (a java.util.HashMap)
        at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:693)
        at org.springframework.context.annotation.ConfigurationClassParser$SourceClass.getMemberClasses(ConfigurationClassParser.java:840)
        at org.springframework.context.annotation.ConfigurationClassParser.processMemberClasses(ConfigurationClassParser.java:340)
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:264)
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245)
        at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:606)
        at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:299)
        at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245)
        at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:606)
        at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:548)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:185)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:308)
        at org.springframework.ide.eclipse.metadata.process.JdtConfigurationClassPostProcessor.postProcess(JdtConfigurationClassPostProcessor.java:88)
        at org.springframework.ide.eclipse.beans.core.internal.model.BeansJavaConfig$3.run(BeansJavaConfig.java:332)
        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
        at org.springframework.ide.eclipse.beans.core.internal.model.BeansJavaConfig.executePostProcessor(BeansJavaConfig.java:321)
        at org.springframework.ide.eclipse.beans.core.internal.model.BeansJavaConfig.access$5(BeansJavaConfig.java:319)
        at org.springframework.ide.eclipse.beans.core.internal.model.BeansJavaConfig$2.call(BeansJavaConfig.java:233)
        at org.springframework.ide.eclipse.beans.core.internal.model.BeansJavaConfig$2.call(BeansJavaConfig.java:1)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
        - <0x000000076033a6d8> (a java.util.concurrent.ThreadPoolExecutor$Worker)

12:19:47

"Background Thread-3 (Spring IDE/3.9.4)" #2091 daemon prio=5 os_prio=31 tid=0x00007fbc3c4a9000 nid=0x193f3 runnable [0x000070000916a000]
   java.lang.Thread.State: RUNNABLE
        at java.io.UnixFileSystem.getBooleanAttributes0(Native Method)
        at java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:242)
        at java.io.File.exists(File.java:819)
        at sun.misc.URLClassPath$FileLoader.getResource(URLClassPath.java:1282)
        at sun.misc.URLClassPath$FileLoader.findResource(URLClassPath.java:1249)
        at sun.misc.URLClassPath.findResource(URLClassPath.java:215)
        at java.net.URLClassLoader$2.run(URLClassLoader.java:569)
        at java.net.URLClassLoader$2.run(URLClassLoader.java:567)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findResource(URLClassLoader.java:566)
        at org.springframework.ide.eclipse.core.java.FilteringURLClassLoader.findResource(FilteringURLClassLoader.java:39)
        at java.lang.ClassLoader.getResource(ClassLoader.java:1096)
        at org.springframework.ide.eclipse.core.java.FilteringURLClassLoader.getResource(FilteringURLClassLoader.java:51)
        at java.net.URLClassLoader.getResourceAsStream(URLClassLoader.java:232)
        at org.springframework.ide.eclipse.core.java.FilteringURLClassLoader.getResourceAsStream(FilteringURLClassLoader.java:57)
        at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:166)
        at org.springframework.ide.eclipse.core.type.asm.SimpleClassReaderFactory.getClassReader(SimpleClassReaderFactory.java:67)
        at org.springframework.ide.eclipse.core.type.asm.CachingClassReaderFactory.getClassReader(CachingClassReaderFactory.java:61)
        - locked <0x00000007b903d2d8> (a java.util.HashMap)
        at org.springframework.ide.eclipse.core.type.asm.SimpleClassReaderFactory.getClassReader(SimpleClassReaderFactory.java:63)
        at org.springframework.ide.eclipse.core.java.classreading.JdtConnectedMetadataReader.<init>(JdtConnectedMetadataReader.java:44)
        at org.springframework.ide.eclipse.core.java.classreading.JdtMetadataReaderFactory.getMetadataReader(JdtMetadataReaderFactory.java:53)
        at org.springframework.ide.eclipse.core.java.classreading.CachingJdtMetadataReaderFactory.getMetadataReader(CachingJdtMetadataReaderFactory.java:38)
        - locked <0x00000007b903d218> (a java.util.HashMap)
        at org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:693)
        at org.springframework.context.annotation.ConfigurationClassParser.asSourceClasses(ConfigurationClassParser.java:675)
        at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:548)
        at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:185)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:308)
        at org.springframework.ide.eclipse.metadata.process.JdtConfigurationClassPostProcessor.postProcess(JdtConfigurationClassPostProcessor.java:88)
        at org.springframework.ide.eclipse.beans.core.internal.model.BeansJavaConfig$3.run(BeansJavaConfig.java:332)
        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
        at org.springframework.ide.eclipse.beans.core.internal.model.BeansJavaConfig.executePostProcessor(BeansJavaConfig.java:321)
        at org.springframework.ide.eclipse.beans.core.internal.model.BeansJavaConfig.access$5(BeansJavaConfig.java:319)
        at org.springframework.ide.eclipse.beans.core.internal.model.BeansJavaConfig$2.call(BeansJavaConfig.java:233)
        at org.springframework.ide.eclipse.beans.core.internal.model.BeansJavaConfig$2.call(BeansJavaConfig.java:1)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
        - <0x000000076033a6d8> (a java.util.concurrent.ThreadPoolExecutor$Worker)

I've tried to turn this off by disabling the Spring-related Project Validators and Project Builders but it doesn't appear to have had any effect.

kdvolder commented 6 years ago

Sorry for the hassles. These are the old STS 3 tooling which haven't aged well. The stuff that is causing these problems will not be a part of STS 4 anymore. So you could try an STS 4 milestone build instead and see if it makes for a 'lighter weight' experience for you.

If you want to continue using STS 3 there's a few things we can try to disable these features.

  1. Disable the builders / validators (sounds like you did that already)
  2. In preferences go to 'Spring >> Bean Support' and check 'Disable Auto Config Detection'

If still not working you may also disable this in individual projects via project context menu at Properties >> Spring >> Beans Support. (Though I think the global switch should make this not necessary).

kdvolder commented 6 years ago

One more thing worth trying. The projects that make up spring boot itself are detected as 'spring boot' projects which enables some STS tooling support specifically for spring-boot apps. But this tooling is really meant to work with apps, not with the spring boot implementation itself. So it could be misbehaving.

There's a way to exclude projects from being treated as 'spring boot projects' here: Window >> Preferences >> Spring >> Boot. You can enter a regexp in the 'Exclude Projects' box. Anyhting matching the regexp will not be treated as a 'Spring Boot project'.

You can verify whether STS thinks your project is a boot project by opening the Spring Boot Dashboard. If your project appears there it means STS 'thinks' its a boot app.

wilkinsona commented 6 years ago

In preferences go to 'Spring >> Bean Support' and check 'Disable Auto Config Detection'

Thanks, Kris. I think this is the setting that I was missing. With that checked things are much more responsive.

kdvolder commented 6 years ago

Glad to hear that it works better for you now.

As the plan is to eventually phase out the old bean builders / models in STS 4, I think we will not try to fix this. So closing this ticket now.