python-jsonrpc-server icon indicating copy to clipboard operation
python-jsonrpc-server copied to clipboard

Received cancel notification for unknown message

Open lilliesAndRoses opened this issue 6 years ago • 7 comments

While using python-jsonrpc-server if I start typing fast in the monaco editor (which I am using coupled with monaco-languageclient), I get a flurry of warnings

WARNING - pyls_jsonrpc.endpoint - Received cancel notification for unknown message

I do see that the jedi component that I use does get invoked, but the auto-completions, linting, signature help - everything simply stops working.

lilliesAndRoses avatar Apr 23 '19 09:04 lilliesAndRoses

It was seen that the linting, completions stopped working when this error was seen previously. Changing the listen function in 'streams.py' to code below seems to have solved it for now. Is this the right issue and fix? I just added another "except AssertionError" handler

def listen(self, message_consumer):
        """Blocking call to listen for messages on the rfile.

        Args:
            message_consumer (fn): function that is passed each message as it is read off the socket.
        """
        while not self._rfile.closed:
            request_str = self._read_message()

            if request_str is None:
                break
            try:
                message_consumer(json.loads(request_str.decode('utf-8')))
            except ValueError:
                log.exception("Failed to parse JSON message %s", request_str)
                continue
            except AssertionError:
                log.exception("AssertionError encountered while consuming message in stream reader. %s", request_str)
                continue

lilliesAndRoses avatar Apr 26 '19 09:04 lilliesAndRoses

Even typing slowly, I got the same error when using emacs and lsp-mode.

Yevgnen avatar Jun 22 '19 08:06 Yevgnen

Can confirm that this issue exists for spacemacs with pyls and lsp-mode

SujaySKumar avatar Dec 20 '19 05:12 SujaySKumar

yup, facing the same issue. any temporary fixes..?

Edit- I just switched to the Microsoft python server. For emacs, it's lsp-python-ms and that works pretty well.

SreenivasVRao avatar Jan 29 '20 03:01 SreenivasVRao

Getting this as well in spacemacs

revmischa avatar Feb 23 '20 11:02 revmischa

Any news on this ?

hugorichard avatar Nov 08 '21 21:11 hugorichard

I think the issue is with the kind of request the client is sending for which we are getting this response. If I'm not wrong, you guys might be using @TypeFox/monaco-languageclient which is the one i used and faced the same issue.

Later I changed the editor and shifted to codemirror (for unknown reasons) and I never faced this issue again with the code-mirror language client.

npradeep357 avatar Nov 22 '21 09:11 npradeep357