zielu / GitToolBox

GitToolBox IntelliJ plugin
GNU General Public License v3.0
607 stars 76 forks source link

GitToolBox failed to initialize with the NPE #298

Closed dgiridharan closed 3 years ago

dgiridharan commented 3 years ago

I really love this product. However, after the last upgrade of the plugin, I'm getting the following error:

Stable Release (20210114.130412) Version: 202.3.1 Stack:

com.intellij.diagnostic.PluginException: Cannot init component state (componentName=GitToolBoxBlamePersistence, componentClass=BlameCalculationPersistence) [Plugin: zielu.gittoolbox]
    at com.intellij.configurationStore.ComponentStoreImpl.initComponent(ComponentStoreImpl.kt:114)
    at com.intellij.configurationStore.ComponentStoreWithExtraComponents.initComponent(ComponentStoreWithExtraComponents.kt:63)
    at com.intellij.serviceContainer.ComponentManagerImpl.initializeComponent$intellij_platform_serviceContainer(ComponentManagerImpl.kt:357)
    at com.intellij.serviceContainer.ServiceComponentAdapter.createAndInitialize(ServiceComponentAdapter.kt:53)
    at com.intellij.serviceContainer.ServiceComponentAdapter.access$createAndInitialize(ServiceComponentAdapter.kt:13)
    at com.intellij.serviceContainer.ServiceComponentAdapter$doCreateInstance$1.run(ServiceComponentAdapter.kt:43)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:629)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:581)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:192)
    at com.intellij.serviceContainer.ServiceComponentAdapter.doCreateInstance(ServiceComponentAdapter.kt:42)
    at com.intellij.serviceContainer.BaseComponentAdapter.getInstanceUncached(BaseComponentAdapter.kt:113)
    at com.intellij.serviceContainer.BaseComponentAdapter.getInstance(BaseComponentAdapter.kt:67)
    at com.intellij.serviceContainer.ComponentManagerImpl.doGetService(ComponentManagerImpl.kt:413)
    at com.intellij.serviceContainer.ComponentManagerImpl.getService(ComponentManagerImpl.kt:395)
    at zielu.gittoolbox.util.AppUtil.getServiceInstance(AppUtil.kt:26)
    at zielu.gittoolbox.blame.calculator.persistence.BlameCalculationPersistence$Companion.getInstance(BlameCalculationPersistence.kt:108)
    at zielu.gittoolbox.blame.calculator.CachingBlameCalculatorLocalGateway$loadFromPersistence$1.invoke(CachingBlameCalculatorLocalGateway.kt:30)
    at zielu.gittoolbox.blame.calculator.CachingBlameCalculatorLocalGateway$loadFromPersistence$1.invoke(CachingBlameCalculatorLocalGateway.kt:14)
    at zielu.intellij.metrics.codehale.CodehaleTimer$sam$java_util_function_Supplier$0.get(CodehaleTimer.kt)
    at com.codahale.metrics.Timer.timeSupplier(Timer.java:136)
    at zielu.intellij.metrics.codehale.CodehaleTimer.timeSupplierKt(CodehaleTimer.kt:10)
    at zielu.gittoolbox.blame.calculator.CachingBlameCalculatorLocalGateway.loadFromPersistence(CachingBlameCalculatorLocalGateway.kt:29)
    at zielu.gittoolbox.blame.calculator.CachingBlameCalculator.getFromPersistence(CachingBlameCalculator.kt:87)
    at zielu.gittoolbox.blame.calculator.CachingBlameCalculator.calculate(CachingBlameCalculator.kt:77)
    at zielu.gittoolbox.blame.calculator.CachingBlameCalculator.access$calculate(CachingBlameCalculator.kt:16)
    at zielu.gittoolbox.blame.calculator.CachingBlameCalculator$loader$1.loadInContext(CachingBlameCalculator.kt:22)
    at zielu.gittoolbox.blame.calculator.CachingBlameCalculator$loader$1.loadInContext(CachingBlameCalculator.kt:19)
    at zielu.intellij.guava.ThreadLocalCacheLoader.load(ThreadLocalCacheLoader.kt:19)
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3529)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2278)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2155)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2045)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3951)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3974)
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4958)
    at zielu.intellij.guava.GuavaExtensionsKt.getSafe(GuavaExtensions.kt:9)
    at zielu.gittoolbox.blame.calculator.CachingBlameCalculator.annotate(CachingBlameCalculator.kt:56)
    at zielu.gittoolbox.blame.BlameLoaderImpl.annotate(BlameLoaderImpl.kt:28)
    at zielu.gittoolbox.blame.BlameCacheImpl$AnnotationLoader.load(BlameCacheImpl.java:226)
    at zielu.intellij.metrics.codehale.CodehaleTimer$sam$java_util_function_Supplier$0.get(CodehaleTimer.kt)
    at com.codahale.metrics.Timer.timeSupplier(Timer.java:136)
    at zielu.intellij.metrics.codehale.CodehaleTimer.timeSupplierKt(CodehaleTimer.kt:10)
    at zielu.gittoolbox.blame.BlameCacheLocalGateway.timeLoad(BlameCacheLocalGateway.kt:31)
    at zielu.gittoolbox.blame.BlameCacheImpl$AnnotationLoader.run(BlameCacheImpl.java:211)
    at zielu.gittoolbox.util.DisposeAfterExecutableTask.run(DisposeAfterExecutableTask.kt:13)
    at zielu.gittoolbox.util.DisposeSafeExecutableTask.run(DisposeSafeExecutableTask.kt:9)
    at zielu.gittoolbox.blame.BlameCacheExecutor$1.run(BlameCacheExecutor.java:65)
    at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:935)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsync$5(CoreProgressManager.java:442)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:235)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:170)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:629)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:581)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:157)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:235)
    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NullPointerException
    at zielu.gittoolbox.blame.calculator.persistence.BlameCalculationPersistence$cleanGarbageImpl$1.test(BlameCalculationPersistence.kt:88)
    at zielu.gittoolbox.blame.calculator.persistence.BlameCalculationPersistence$cleanGarbageImpl$1.test(BlameCalculationPersistence.kt:18)
    at java.base/java.util.Collection.removeIf(Collection.java:544)
    at zielu.gittoolbox.blame.calculator.persistence.BlameCalculationPersistence.cleanGarbageImpl(BlameCalculationPersistence.kt:88)
    at zielu.gittoolbox.blame.calculator.persistence.BlameCalculationPersistence.cleanGarbage(BlameCalculationPersistence.kt:82)
    at zielu.gittoolbox.blame.calculator.persistence.BlameCalculationPersistence.initializeComponent(BlameCalculationPersistence.kt:36)
    at com.intellij.configurationStore.ComponentStoreImpl.initComponent(ComponentStoreImpl.kt:103)
    ... 64 more

Please let me know if you'd like more details and I'd be more than happy to help! Thank you very much in advance!

zielu commented 3 years ago

I thought it was fixed in #284, looks like I missed something

zielu commented 3 years ago

@dgiridharan could you switch to EAP channel ? (https://github.com/zielu/GitToolBox#eap-builds) there is 202.3.2 in there that has some improvements and logging so it's more visible why it fails.

dgiridharan commented 3 years ago

Here's the new stack after swittching to the EAP: EAP Release (20210208.133835) Version: 202.3.2

java.lang.NullPointerException
    at zielu.gittoolbox.blame.calculator.persistence.BlameCalculationPersistence.cleanGarbageImpl(BlameCalculationPersistence.kt:98)
    at zielu.gittoolbox.blame.calculator.persistence.BlameCalculationPersistence.cleanGarbage(BlameCalculationPersistence.kt:86)
    at zielu.gittoolbox.blame.calculator.persistence.BlameCalculationPersistence.initializeComponent(BlameCalculationPersistence.kt:39)
    at com.intellij.configurationStore.ComponentStoreImpl.initComponent(ComponentStoreImpl.kt:103)
    at com.intellij.configurationStore.ComponentStoreWithExtraComponents.initComponent(ComponentStoreWithExtraComponents.kt:63)
    at com.intellij.serviceContainer.ComponentManagerImpl.initializeComponent$intellij_platform_serviceContainer(ComponentManagerImpl.kt:357)
    at com.intellij.serviceContainer.ServiceComponentAdapter.createAndInitialize(ServiceComponentAdapter.kt:53)
    at com.intellij.serviceContainer.ServiceComponentAdapter.access$createAndInitialize(ServiceComponentAdapter.kt:13)
    at com.intellij.serviceContainer.ServiceComponentAdapter$doCreateInstance$1.run(ServiceComponentAdapter.kt:43)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:629)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:581)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:192)
    at com.intellij.serviceContainer.ServiceComponentAdapter.doCreateInstance(ServiceComponentAdapter.kt:42)
    at com.intellij.serviceContainer.BaseComponentAdapter.getInstanceUncached(BaseComponentAdapter.kt:113)
    at com.intellij.serviceContainer.BaseComponentAdapter.getInstance(BaseComponentAdapter.kt:67)
    at com.intellij.serviceContainer.ComponentManagerImpl.doGetService(ComponentManagerImpl.kt:413)
    at com.intellij.serviceContainer.ComponentManagerImpl.getService(ComponentManagerImpl.kt:395)
    at zielu.gittoolbox.util.AppUtil.getServiceInstance(AppUtil.kt:26)
    at zielu.gittoolbox.blame.calculator.persistence.BlameCalculationPersistence$Companion.getInstance(BlameCalculationPersistence.kt:123)
    at zielu.gittoolbox.blame.calculator.CachingBlameCalculatorLocalGateway$loadFromPersistence$1.invoke(CachingBlameCalculatorLocalGateway.kt:30)
    at zielu.gittoolbox.blame.calculator.CachingBlameCalculatorLocalGateway$loadFromPersistence$1.invoke(CachingBlameCalculatorLocalGateway.kt:14)
    at zielu.intellij.metrics.codehale.CodehaleTimer$sam$java_util_function_Supplier$0.get(CodehaleTimer.kt)
    at com.codahale.metrics.Timer.timeSupplier(Timer.java:136)
    at zielu.intellij.metrics.codehale.CodehaleTimer.timeSupplierKt(CodehaleTimer.kt:10)
    at zielu.gittoolbox.blame.calculator.CachingBlameCalculatorLocalGateway.loadFromPersistence(CachingBlameCalculatorLocalGateway.kt:29)
    at zielu.gittoolbox.blame.calculator.CachingBlameCalculator.getFromPersistence(CachingBlameCalculator.kt:87)
    at zielu.gittoolbox.blame.calculator.CachingBlameCalculator.calculate(CachingBlameCalculator.kt:77)
    at zielu.gittoolbox.blame.calculator.CachingBlameCalculator.access$calculate(CachingBlameCalculator.kt:16)
    at zielu.gittoolbox.blame.calculator.CachingBlameCalculator$loader$1.loadInContext(CachingBlameCalculator.kt:22)
    at zielu.gittoolbox.blame.calculator.CachingBlameCalculator$loader$1.loadInContext(CachingBlameCalculator.kt:19)
    at zielu.intellij.guava.ThreadLocalCacheLoader.load(ThreadLocalCacheLoader.kt:19)
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3529)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2278)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2155)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2045)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3951)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3974)
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4958)
    at zielu.intellij.guava.GuavaExtensionsKt.getSafe(GuavaExtensions.kt:9)
    at zielu.gittoolbox.blame.calculator.CachingBlameCalculator.annotate(CachingBlameCalculator.kt:56)
    at zielu.gittoolbox.blame.BlameLoaderImpl.annotate(BlameLoaderImpl.kt:28)
    at zielu.gittoolbox.blame.BlameCacheImpl$AnnotationLoader.load(BlameCacheImpl.java:226)
    at zielu.intellij.metrics.codehale.CodehaleTimer$sam$java_util_function_Supplier$0.get(CodehaleTimer.kt)
    at com.codahale.metrics.Timer.timeSupplier(Timer.java:136)
    at zielu.intellij.metrics.codehale.CodehaleTimer.timeSupplierKt(CodehaleTimer.kt:10)
    at zielu.gittoolbox.blame.BlameCacheLocalGateway.timeLoad(BlameCacheLocalGateway.kt:31)
    at zielu.gittoolbox.blame.BlameCacheImpl$AnnotationLoader.run(BlameCacheImpl.java:211)
    at zielu.gittoolbox.util.DisposeAfterExecutableTask.run(DisposeAfterExecutableTask.kt:13)
    at zielu.gittoolbox.util.DisposeSafeExecutableTask.run(DisposeSafeExecutableTask.kt:9)
    at zielu.gittoolbox.blame.BlameCacheExecutor$1.run(BlameCacheExecutor.java:65)
    at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:935)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsync$5(CoreProgressManager.java:442)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:235)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:170)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:629)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:581)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:157)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:235)
    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
    at java.base/java.lang.Thread.run(Thread.java:834)
zielu commented 3 years ago

@dgiridharan I just pushed 202.3.3 it should log exactly what I need.

zielu commented 3 years ago

Should be fixed in 202.3.4 - this must be some data corruption, because there is no way that there can be a null in any of the fields. In case when there is one (probably inserted by reflection during deserialization by Platform) error is shown but blame cache is emptied to clean up bad data.