Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add client progress for delegate commands #2821

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hopehadfield
Copy link
Contributor

Fixes #1186

Copy link
Contributor

@rgrunber rgrunber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, but there's a problem.

type-hierarchy-spinning-forever

This behaviour seems similar to what's described in redhat-developer/vscode-java#3249 so maybe there's an existing bug in the progress report where some tasks don't received an end notification.

@rgrunber rgrunber added this to the End August 2023 milestone Aug 28, 2023
@rgrunber
Copy link
Contributor

rgrunber commented Aug 30, 2023

CC : @testforstephen

So I looked at one of the progress messages that hang :

[Trace - 16:36:54] Received notification '$/progress'.
Params: {
    "token": "b0a92711-cde3-4701-a8c3-a7b7a07a0f2f",
    "value": {
        "kind": "report",
        "message": "Background task - 75% Locating Java matches...",
        "percentage": 75
    }
}

and looked earlier at what kind of messages fall under b0a92711-cde3-4701-a8c3-a7b7a07a0f2f.

[Info  - 16:36:50] Aug. 30, 2023, 4:36:50 p.m. >> workspace/executeCommand vscode.java.test.findTestPackagesAndTypes
[Trace - 16:36:50] Received request 'window/workDoneProgress/create - (47)'.
Params: {
    "token": "b0a92711-cde3-4701-a8c3-a7b7a07a0f2f"
}

...
...

[Trace - 16:36:50] Received notification '$/progress'.
Params: {
    "token": "b0a92711-cde3-4701-a8c3-a7b7a07a0f2f",
    "value": {
        "kind": "begin",
        "title": "Searching for JUnit 5 tests...",
        "message": "Searching for JUnit 5 tests..."
    }
}

[Trace - 16:36:50] Received notification '$/progress'.
Params: {
    "token": "b0a92711-cde3-4701-a8c3-a7b7a07a0f2f",
    "value": {
        "kind": "report",
        "message": "Searching for JUnit 5 tests... - 0% ",
        "percentage": 0
    }
}

Looks to me like this is called by https://github.com/microsoft/vscode-java-test/blob/main/src/controller/testController.ts#L44-L67 whenever java.test.explorer.loadChildren occurs ? Probably when we load type hierarchy children ?

There's even an error from the delegate call on the JDT-LS side :

!ENTRY com.microsoft.java.test.plugin 4 0 2023-08-30 16:56:02.252
!MESSAGE failed to search tests in: java
!STACK 1
Java Model Exception: Error in Java Model (code 969): <anonymous #1> {key=Lorg/eclipse/lemminx/extensions/contentmodel/XMLSchemaCompletionExtensionsTest$75658;} [in accept(org.eclipse.lemminx.services.XMLLanguageService) [in <lambda #1> [in customProtocolNamespaceSchemaLocationCompletionWhenCachingOn() [in XMLSchemaCompletionExtensionsTest [in XMLSchemaCompletionExtensionsTest.java [in org.eclipse.lemminx.extensions.contentmodel [in src/test/java [in org.eclipse.lemminx]]]]]]]] does not exist
	at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:550)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:593)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:304)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:290)
	at org.eclipse.jdt.internal.core.Member.getFlags(Member.java:172)
	at org.eclipse.jdt.internal.junit.util.CoreTestSearchEngine.isAccessibleClass(CoreTestSearchEngine.java:64)
	at org.eclipse.jdt.internal.junit.launcher.JUnit5TestFinder.internalIsTest(JUnit5TestFinder.java:251)
	at org.eclipse.jdt.internal.junit.launcher.JUnit5TestFinder.findTestsInContainer(JUnit5TestFinder.java:221)
	at com.microsoft.java.test.plugin.searcher.JUnit5TestSearcher.findTestItemsInContainer(JUnit5TestSearcher.java:130)
	at com.microsoft.java.test.plugin.util.TestSearchUtils.findTestPackagesAndTypes(TestSearchUtils.java:168)
	at com.microsoft.java.test.plugin.handler.TestDelegateCommandHandler.executeCommand(TestDelegateCommandHandler.java:56)
	at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler$1.run(WorkspaceExecuteCommandHandler.java:230)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler.executeCommand(WorkspaceExecuteCommandHandler.java:220)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$4(JDTLanguageServer.java:612)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$59(JDTLanguageServer.java:1202)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)

I want to merge this, but we should really wait to confirm that the delegates commands are well behaved and don't result in report error, which result in spinning forever.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gives the capability to execute command with client progress support
2 participants