Progress indicator is not closed in some instances

Answered

Hi all,

I have a problem where a progress indicator is not closed in some rare instances. The code which starts the task can be found here: https://gitlab.com/ppiag/intellij_gitlab_pipeline_monitor/-/blob/master/src/main/java/de/sist/gitlab/BackgroundUpdateService.java#L76

I have found no pattern when this happens. I have a button which starts this task and I can click it multiple times and everything works as expected but the task is also periodically started by a background task and at some point, sooner or later, I see the progress indicator which doesn't close and doesn't have a task behind it (as far as I can tell).

Is there any way to debug this?

I found the line `2021-04-28 19:46:45,546 [16121866] WARN - .AbstractProgressIndicatorBase - This progress indicator is indeterminate, this may lead to visual inconsistency. Please call setIndeterminate(false) before you start progress.
git4idea.commands.GitStandardProgressAnalyzer$1.onLineAvailable(GitStandardProgressAnalyzer.java:46) ` which may indicate a bug but probably(?) isn't related to my problem.

Thank you.

0
14 comments

Anybody? I'm close to just not using a progress indicator (or using an inivisible one) but that's not really a solution...

0

To verify that it "doesn't have a task behind it" you can take a thread dump in this moment and post it here. (Or analyze it yourself to see if the background task really is completed or stuck somewhere)

0

Alexey Kudravtsev Thanks for the response.

This is my thread dump: https://pastebin.com/82M2GeuC

No threads related to my code (package "de.sist.*") are contained. Three progress indicators are still open:

I see one thread related to `com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:773)` which seems to be the one that draws the actuall display.

0

Alexey Kudravtsev

I recently found out that this happens if the task is completed too quickly. I now start a stopwatch at the beginning and if the elapsed time before completion is less than 500ms I just sleep for 500ms. I'm pretty sure there's a bug in the code that's supposed to not show a progress bar when a task is only active for a short time.

0

Wow, if you were able to reproduce this, it would be a great find, thank you!

0

Alexey Kudravtsev

I was able to reproduce it with a simple demo class: https://pastebin.com/i54W1h2c

It seems to be related to the AppScheduledExecutorService. When starting the background process task from the GUI the bug doesn't happen.

1

Thanks for trying to reproduce. However, I was unable to reproduce the reproducer D)

>When starting the background process task from the GUI the bug doesn't happen.

Then how to start it?

0

Hello Simon. 

I'm still unable to reproduce this. Stranger things happen indeed.

1) Does it reproduce when you replace 

ProgressManager.getInstance().runProcessWithProgressAsynchronously(longRunningTask, new BackgroundableProcessIndicator(shortRunningTask))

with

ProgressManager.getInstance().runProcessWithProgressAsynchronously(longRunningTask, new BackgroundableProcessIndicator(longRunningTask))

2) What version do you use? Does it reproduce in the latest EAP (https://confluence.jetbrains.com/display/IDEADEV/IDEA+2021.2+latest+builds ) ?

0

The problem does indeed not occur on 212.4638.7-EAP-SNAPSHOT

It does occur on 203.8084-EAP-CANDIDATE-SNAPSHOT.

I'm still on 2020.3 due to some nasty bugs in 2021 (but that's another matter).

Of course that was a stupid error in my reproducer code but even with `ProgressManager.getInstance().runProcessWithProgressAsynchronously(longRunningTask, new BackgroundableProcessIndicator(longRunningTask))` the progress bar doesn't go away.

0

Thank you very much for trying to reproduce this. I think we'll leave this as is, because there were quite a number of changes in ProgressManager subsystem since 2020.3 and backporting them all to 2020.3 is problematic.

0

I am on IntelliJIdea2021.2

 

2021-09-10 18:20:36,455 [ 40240] INFO - oad.SharedIndexDownloadService - Fetching shared index: SharedIndexResult(request='JdkIndexRequest(sdkName=11, hash=e731f1b9ca7c8daeda60cff99d29d81572204123, aliases=[11.0.11, 11], kind=jdk)', url='https://index-cdn.jetbrains.com/v2/data/jdk/e731f1b9ca7c8daeda60cff99d29d81572204123/11.0.11-adopt-openjdk-11.0.11-mac-06853fe61d9b8b3145dfed47d93f746d33477211b90ccb1de4704df001e1ed04.ijx.xz', weakHash=2d53250d4c35, weakBaseVersionHash=1645f8fc6d06, sha256='06853fe61d9b8b3145dfed47d93f746d33477211b90ccb1de4704df001e1ed04') ([JdkSharedIndexSuggestion(SharedIndexId(kind=jdk, url=https://index-cdn.jetbrains.com/v2/jdk, indexId=b7eb581293c79f70416d50a1176dd686f8445a9f6c7908bbca923b44d2192317#java version "11.0.11"), lazy)])
2021-09-10 18:20:36,548 [ 40333] WARN - .AbstractProgressIndicatorBase - This progress indicator is indeterminate, this may lead to visual inconsistency. Please call setIndeterminate(false) before you start progress. class com.intellij.openapi.progress.impl.BackgroundableProcessIndicator
java.lang.IllegalStateException
at com.intellij.openapi.progress.util.AbstractProgressIndicatorBase.setFraction(AbstractProgressIndicatorBase.java:203)
at com.intellij.openapi.progress.util.AbstractProgressIndicatorExBase.setFraction(AbstractProgressIndicatorExBase.java:124)
at com.intellij.openapi.progress.util.ProgressWindow.setFraction(ProgressWindow.java:328)
at com.intellij.openapi.progress.util.RelayUiToDelegateIndicator.setFraction(RelayUiToDelegateIndicator.java:32)
at com.intellij.openapi.progress.util.AbstractProgressIndicatorBase.initStateFrom(AbstractProgressIndicatorBase.java:327)
at com.intellij.openapi.progress.util.AbstractProgressIndicatorExBase.initStateFrom(AbstractProgressIndicatorExBase.java:222)
at com.intellij.openapi.progress.util.AbstractProgressIndicatorExBase.addStateDelegate(AbstractProgressIndicatorExBase.java:162)
at com.intellij.indexing.shared.download.SharedIndexDownloadExecutor$submitPreProgressSync$1$context$1$showBackgroundableProgress$task$1.run(SharedIndexDownloadExecutor.kt:234)
at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:450)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:117)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsync$5(CoreProgressManager.java:510)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:243)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:183)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:705)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:647)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:63)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:170)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:243)
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:829)

0

Same here with IntelliJ IDEA 2021.2.3 Ultimate Edition

2021-10-26 19:43:31,148 [  20881]   WARN - .AbstractProgressIndicatorBase - This progress indicator is indeterminate, this may lead to visual inconsistency. Please call setIndeterminate(false) before you start progress. class com.intellij.openapi.progress.impl.BackgroundableProcessIndicator 
java.lang.IllegalStateException
at com.intellij.openapi.progress.util.AbstractProgressIndicatorBase.setFraction(AbstractProgressIndicatorBase.java:203)
at com.intellij.openapi.progress.util.AbstractProgressIndicatorExBase.setFraction(AbstractProgressIndicatorExBase.java:124)
at com.intellij.openapi.progress.util.ProgressWindow.setFraction(ProgressWindow.java:328)
at com.intellij.openapi.progress.util.RelayUiToDelegateIndicator.setFraction(RelayUiToDelegateIndicator.java:32)
at com.intellij.openapi.progress.util.AbstractProgressIndicatorBase.initStateFrom(AbstractProgressIndicatorBase.java:327)
at com.intellij.openapi.progress.util.AbstractProgressIndicatorExBase.initStateFrom(AbstractProgressIndicatorExBase.java:222)
at com.intellij.openapi.progress.util.AbstractProgressIndicatorExBase.addStateDelegate(AbstractProgressIndicatorExBase.java:162)
at com.intellij.indexing.shared.download.SharedIndexDownloadExecutor$submitPreProgressSync$1$context$1$showBackgroundableProgress$task$1.run(SharedIndexDownloadExecutor.kt:234)
at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:450)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:117)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsync$5(CoreProgressManager.java:510)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:243)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:183)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:705)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:647)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:63)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:170)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:243)
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:829)
0

Thanks for reporting!

The issue related to the mentioned SharedIndexDownloadExecutor warning cause is already handled – the fix is available in the 2021.3 release cycle: https://youtrack.jetbrains.com/issue/IDEA-272135

1

Please sign in to leave a comment.