You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2021/03/10 08:51:14 UTC

[GitHub] [netbeans] sdedic opened a new pull request #2799: Lsp/cancellation

sdedic opened a new pull request #2799:
URL: https://github.com/apache/netbeans/pull/2799


   When Maven repository transfer is cancelled from LSP client, the following exception may be printed to the log:
   ```
   WARNING [org.eclipse.lsp4j.jsonrpc.RemoteEndpoint]: Notification threw an exception: {
   "jsonrpc": "2.0",
   "method": "window/workDoneProgress/cancel",
   "params":
   { "token": "7c465cf8-43c0-4ef4-a7c9-fb0eb456a779" }
   
   }
   java.lang.UnsupportedOperationException
   at org.eclipse.lsp4j.services.LanguageServer.cancelProgress(LanguageServer.java:96)
   Caused: java.lang.reflect.InvocationTargetException
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:498)
   at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
   Caused: java.lang.RuntimeException
   at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:67)
   at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.notify(GenericEndpoint.java:152)
   [catch] at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(RemoteEndpoint.java:220)
   at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:187)
   at org.netbeans.modules.java.lsp.server.protocol.Server$ConsumeWithLookup$1.lambda$consume$0(Server.java:202)
   at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
   at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
   at org.netbeans.modules.java.lsp.server.protocol.Server$ConsumeWithLookup$1.consume(Server.java:200)
   at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
   at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
   at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
   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:1149)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
   at java.lang.Thread.run(Thread.java:748)
   ```
   
   The execution reached `default` method implemenation that throws an exception.
   
   The fix is trivial, since cancellation is handled centrally in a message interceptor in `Server`, but I've spent most of the time writing test that checks a process is really cancelled. I have added Maven module as test dependency, and tested the Cancel notification by stopping a running maven build. 
   Let's see how it will work on buildservers in test suites; the other option is to mock MavenExecutor and block the execution long enough so it can be cancelled using LSP protocol.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] sdedic merged pull request #2799: LSP progress cancel request may not work

Posted by GitBox <gi...@apache.org>.
sdedic merged pull request #2799:
URL: https://github.com/apache/netbeans/pull/2799


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists