Large websocket responses get truncated and cannot be parsed
See original GitHub issueDescription
Sometimes a very long response from the language server gets truncated and the relevant action is not performed. This appears to be somewhat random, because subsequent attempts can sometimes succeed.
Uncaught SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at i.readMessage (index.js:formatted:1)
at index.js:formatted:1
at WebSocket.e.onmessage (index.js:formatted:1)
readMessage @ index.js:formatted:1
(anonymous) @ index.js:formatted:1
e.onmessage @ index.js:formatted:1
The message truncates at less than 7k characters
Similar issue was reported in a different project using PHP backend here: https://github.com/beyondcode/dusk-dashboard/issues/20.
Reproduce
- Open an R notebook
- Type
base::
(potentially press <kbd>Tab</kbd>, but should auto-invoke) - See lack of completion suggestions and error in console
Expected behavior
- We may want to try to recover truncated JSON messages by parsing the viable portion (e.g. for completion it would make sense to show something rather than nothing, especially for extra long namespaces such as
base
in R) - The error should not happen in the first place
Context
- Operating System and version: Ubuntu 20.10
- Browser and version: Chrome
- JupyterLab version: 2.2.x
master on 2.1.2
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (8 by maintainers)
Top Results From Across the Web
Message sent truncated to the size of data received
So... After much debugging, I'm still stuck. I have figured out that the encrypted message is the entire string. However, what is sent...
Read more >Request truncates large response body · Issue #1418 - GitHub
One thing I noticed is that JSON.parse fails silently, so in the case of an issue like this, we expect a JSON object,...
Read more >WebSocket Client - Portal - StreamSets Docs
You can use the WebSocket Client origin to read REST response JSON data generated by Data ... Larger messages cannot be processed or...
Read more >RFC 6455: The WebSocket Protocol
The format and parsing of headers is as defined in [RFC2616]. Once the client and server have both sent their handshakes, and if...
Read more >Serverless SQL pool self-help - Azure Synapse Analytics
String or binary data would be truncated You can fix this error by increasing the length of the column type: If your string...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ll try using my hack for a day or so and if I don’t run into any problems, I’ll create a PR
I believe I’m using the fixed code from above. I have jupyter-lsp 1.1.1 and jupyterlab-lsp 3.2.0
I’m seeing this truncated output with the Jedi language server, pretty much all the time.
By way of an experiment, I changed line 122 in the _read_content method of the stdio.py from ‘break’ to ‘continue’.
The problem went away.
I wonder if the problem is that this async consumer routine is reading output from an async producer routine which just is not ready with its next chunk of data – jedi language server not being the fastest tool in the shed.
So, maybe changing the ‘break’ to ‘continue’ and max_parts to some smaller number is a better way to go ??
I’m going to keep this change for a while and see how it goes.
Thanks