-
Notifications
You must be signed in to change notification settings - Fork 21
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
Mishandling of process.write
#60
Comments
Could you provide some steps/project/configuration to reproduce? |
It is not always reproducible as it depends on how fast the language server is able to handle the data, but is usually enough to open a relatively big file. It likely depends on system load too. This could also be one of the causes of the sporadic desynchronization some people see. You can try logging the size of the data to send, compared to
A simpler test would be done with the |
* Drops `requests_in_chunks` server option * See issue #60 for more details
Ok, after some sleep properly read what you described, pushed a change that "should" fix the problem, let me know if it fixes it on your testing or if I introduced more bugs :) |
I added a few comments to the commit. EDIT: |
Ok, will implement your suggestions later and borrow more from your primary_selection code for the incremental yielding timeout + err checking (I thought about the process_write + yielding reuse but wasn't sure) , thanks for reviewing the commit! Also, I haven't hit a lockup yet but I'm using luajit + threading branch and the default 1ms coroutine timeout change. |
The other set of suggestions handled on this commit 27c241d except for the raw processing chunk chop out. |
More suggested corrections 607cc85 |
It looks like
Server:write_request
is happily truncating lots of data, causing LSP servers like sumneko to crash.This is happening because
process.write
can sometimes not write the entire proposed buffer at once, even if the buffer is small.For example, checking the non-chunked part of the function:
lite-xl-lsp/server.lua
Lines 1306 to 1314 in 20f33d0
this will exit even after only writing a single byte.
Also instead of exiting on timeout, it might be better to retry the write a bunch of times waiting a bit between retries. This will improve the chances that the buffer is consumed by the process. Kinda like what I'm doing in the
primary_selection
plugin:https://github.com/lite-xl/lite-xl-plugins/blob/68a2a6ac694e66cc4bb005d00c9debaa751d8fe7/plugins/primary_selection.lua#L99-L119
Handling this correctly will render the chunked part of the function useless.
The text was updated successfully, but these errors were encountered: