zielu / GitToolBox

GitToolBox IntelliJ plugin
GNU General Public License v3.0
604 stars 71 forks source link

NPE when opening project #427

Closed ylexus closed 1 year ago

ylexus commented 1 year ago

GitToolBox 212.9.9. This has just occurred to me when I cloned a project and then when IDEA opened it I closed the project while it was still loading it. Will probably be hard to reproduce, but still.

IntelliJ IDEA 2022.2.3 (Ultimate Edition)
Build #IU-222.4345.14, built on October 5, 2022
Licensed to XXX

Runtime version: 17.0.4.1+7-b469.62 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 16384M
Cores: 24
Registry:
    debugger.click.disable.breakpoints=true
    analyze.exceptions.on.the.fly=true

Non-Bundled Plugins:
    com.ivanovych666.intellij.plugin.jsonsorter (1.0.0-beta.3.4)
    ru.artyushov (1.3.0)
    com.intellij.ideolog (203.0.30.0)
    com.intellij.commander (222.4345.14)
    YourKit Java Profiler 2018.04-b88 Integration (2018.4.88.0)
    GrepConsole (12.15.211.6693.1)
    zielu.gittoolbox (212.9.9)
    Jetbrains TeamCity Plugin (2022.10.116751)

Kotlin: 222-1.7.20-release-201-IJ4167.29
java.util.concurrent.ExecutionException: java.lang.NullPointerException
    at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
    at git4idea.fetch.GitFetchSupportImpl.waitForFetchTasks(GitFetchSupportImpl.kt:191)
    at git4idea.fetch.GitFetchSupportImpl.access$waitForFetchTasks(GitFetchSupportImpl.kt:47)
    at git4idea.fetch.GitFetchSupportImpl$fetch$1.invoke(GitFetchSupportImpl.kt:107)
    at git4idea.fetch.GitFetchSupportImpl$fetch$1.invoke(GitFetchSupportImpl.kt:47)
    at git4idea.fetch.GitFetchSupportImpl.withIndicator(GitFetchSupportImpl.kt:213)
    at git4idea.fetch.GitFetchSupportImpl.fetch(GitFetchSupportImpl.kt:103)
    at git4idea.fetch.GitFetchSupportImpl.fetchAllRemotes(GitFetchSupportImpl.kt:89)
    at zielu.gittoolbox.k.Q.a(SourceFile:25)
    at zielu.gittoolbox.k.O.b(SourceFile:171)
    at com.codahale.metrics.Timer.timeSupplier(Timer.java:136)
    at zielu.a.i.a.e.a(SourceFile:14)
    at zielu.gittoolbox.k.O.a(SourceFile:171)
    at zielu.gittoolbox.k.O.b(SourceFile:157)
    at zielu.gittoolbox.k.O.a(SourceFile:138)
    at zielu.gittoolbox.k.O.b(SourceFile:244)
    at zielu.gittoolbox.k.O.run(SourceFile:229)
    at zielu.a.b.f.a(SourceFile:11)
    at zielu.a.b.o.a(SourceFile:21)
    at zielu.a.b.o.invoke(SourceFile:18)
    at zielu.a.m.d.a(SourceFile:23)
    at zielu.a.b.l.run(SourceFile:18)
    at zielu.a.b.b.run(SourceFile:64)
    at zielu.a.b.f.a(SourceFile:11)
    at zielu.a.b.o.a(SourceFile:21)
    at zielu.a.b.o.invoke(SourceFile:18)
    at zielu.a.m.d.a(SourceFile:23)
    at zielu.a.b.l.run(SourceFile:18)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.NullPointerException
    at java.base/java.util.Objects.requireNonNull(Objects.java:208)
    at git4idea.GitVcs.getInstance(GitVcs.java:82)
    at git4idea.commands.GitHandler.<init>(GitHandler.java:141)
    at git4idea.commands.GitHandler.<init>(GitHandler.java:89)
    at git4idea.commands.GitHandler.<init>(GitHandler.java:107)
    at git4idea.commands.GitTextHandler.<init>(GitTextHandler.java:45)
    at git4idea.commands.GitLineHandler.<init>(GitLineHandler.java:56)
    at git4idea.commands.GitImpl.lambda$fetch$3(GitImpl.java:613)
    at git4idea.commands.GitImplBase.run(GitImplBase.java:116)
    at git4idea.commands.GitImplBase.runCommand(GitImplBase.java:69)
    at git4idea.commands.GitImpl.fetch(GitImpl.java:612)
    at git4idea.fetch.GitFetchSupportImpl.doFetch(GitFetchSupportImpl.kt:225)
    at git4idea.fetch.GitFetchSupportImpl.access$doFetch(GitFetchSupportImpl.kt:47)
    at git4idea.fetch.GitFetchSupportImpl$fetchInParallel$future$1$1$1.invoke(GitFetchSupportImpl.kt:156)
    at git4idea.fetch.GitFetchSupportImpl$fetchInParallel$future$1$1$1.invoke(GitFetchSupportImpl.kt:47)
    at git4idea.fetch.GitRemoteOperationQueueImpl.executeForRemote(GitRemoteOperationQueueImpl.kt:26)
    at git4idea.fetch.GitFetchSupportImpl$fetchInParallel$future$1$1.run(GitFetchSupportImpl.kt:155)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:608)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:607)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
    at git4idea.fetch.GitFetchSupportImpl$fetchInParallel$future$1.call(GitFetchSupportImpl.kt:153)
    at git4idea.fetch.GitFetchSupportImpl$fetchInParallel$future$1.call(GitFetchSupportImpl.kt:47)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:241)
    at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:31)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:214)
    at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:212)
    at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:203)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
    ... 1 more
zielu commented 1 year ago

There are ways to avoid it to some extent but it requires rework of threading within the plugin (which is coming).

Essentially it is task from closed project starting to execute when shutdown was started but task did not receive notification about it.

zielu commented 1 year ago

Will be fixed in #445