-
-
Notifications
You must be signed in to change notification settings - Fork 104
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
exit when no more data available #178
Conversation
It's not working properly on my end. I have tested it with the Looks like Maybe we need something like: async def _read(loop, executor, read_fn, timeout=1):
return await asyncio.wait_for(
loop.run_in_executor(executor, read_fn),
timeout=timeout) and then use it as: try:
header = await _read(loop, executor, rfile.readline)
except asyncio.TimeoutError:
continue # ? and try:
body = await _read(loop, executor, partial(rfile.read, content_length))
except asyncio.TimeoutError:
continue # ? I tried but something is not working. I won't have time to look in detail this week, could you try it out? If you want to run an example using pipes, just set this env to "false" and only launch the client. You can check logs to see if the event loop is closed. |
That is surprising to me: I've found that it works live - and the testcase that I added is also somewhat convincing. (My motivation for getting involved in this was a recent change in the neovim LSP client which left jedi-language-server orphaned. The neovim change has been reverted for now, but I verified meanwhile that this fix was sufficient to resolve the problem.) What you are suggesting probably works I would expect, but I don't think it ought to be necessary. Not sure that I'll get to trying it any sooner than you, but will update if I do. |
Actually a couple of questions:
|
The log file created by Also, if I added a few Which platform do you use? I know that CI covers windows and Linux, so it's quite strange.
It is if it is set to Please take a look: pygls-io.movI have tested both normal process shutdown and forced one in the video. What is weird is that once I got |
I'm on linux (via WSL, though I don't suppose that matters). I'm not familiar with vscode and can't tell what you're doing in that video. So I'm afraid I still don't understand what you're hitting and unhappy with! What is "forced shutdown"? Whatever it is that you are seeing, I think it must be different from what I have fixed, and what I believe #173 describes. My understanding of that bug is that it is all about what happens if the client unexpectedly exits ("killing emacs with SIGKILL"), and what I am aiming to do is make sure that the server also exits in that case. I have verified that this works live (via the neovim client), and added unit test to prove it. And if you try the original reproducer in the opening comment of #173, the behaviour is now quite different, we just exit at once. Another way to verify this: change into
I'm tempted to suggest that this fix is good and should be merged, and track whatever the other thing is separately. |
Logs are not related to the VS Code, but I have checked the server process manually and it's being killed properly. I will merge PR and release the new version, thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Description (e.g. "Related to ...", etc.)
Fixes #173.
I agree with recent comments saying that receiving an empty header at readline tells you that you're done: per https://docs.python.org/3/tutorial/inputoutput.html#methods-of-file-objects
So that's what this does.
If this looks good, I wonder whether it's time for a 0.10.3 release? There have been a handful of bug fixes that it would be nice to see published.
Code review checklist (for code reviewer to complete)