Skip to content
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

[Discussion] drop 25.x support #1668

Closed
yyoncho opened this issue May 8, 2020 · 10 comments · Fixed by #1954
Closed

[Discussion] drop 25.x support #1668

yyoncho opened this issue May 8, 2020 · 10 comments · Fixed by #1954
Milestone

Comments

@yyoncho
Copy link
Member

yyoncho commented May 8, 2020

Opening the discussion. I am now investigating whether threads could be used to improve lsp-mode responsiveness in certain cases(e. g. file watches).

@ngquerol
Copy link

ngquerol commented May 10, 2020

I thought I'd mention that there seems to be problems with Emacs lisp threads; See the third paragraph in this article.

Now I have no idea if these problems remain in 27.x (that would still be a problem for 26.x), but if that is the case, it may be detrimental to the stability of lsp-mode. Even then, this is a low-level API and as such can deadlock Emacs instances completely.

@yyoncho
Copy link
Member Author

yyoncho commented May 11, 2020

Now I have no idea if these problems remain in 27.x (that would still be a problem for 26.x), but if that is the case, it may be detrimental to the stability of lsp-mode. Even then, this is a low-level API and as such can deadlock Emacs instances completely.

The problem(which is by design ftr) is still here - we are going to use it for background tasks and use thread-yield in the task so instead of locking emacs for 1-2 seconds emacs will be able to respond to keyboard events.

@kiennq
Copy link
Member

kiennq commented May 11, 2020

If I understand correctly, Emacs only allow one thread run at a time, once you yield the thread, it will no longer proceeding, which kind of background tasks can you use for that?

@yyoncho
Copy link
Member Author

yyoncho commented May 11, 2020

@kiennq check this - yyoncho@a5facf7

@kiennq
Copy link
Member

kiennq commented May 11, 2020

So you yield the thread immediately after running it so that it will be run later and can be resumed at specific points?
Why don't use generator instead of that? I think thread on Emacs is costly according to the article @ngquerol pointed out, while generator is better now.

@yyoncho
Copy link
Member Author

yyoncho commented May 11, 2020

So you yield the thread immediately after running it so that it will be run later and can be resumed at specific points?

This part might change, the code is POC.

Why don't use generator instead of that?

If it works I am fine - can you provide a prototype?

I think thread on Emacs is costly according to the article

We might use one worker thread. But more concerning is:

Update: ThreadSanitizer (TSan) quickly shows that Emacs’ threading implementation has many data races, making it completely untrustworthy. Until this is fixed, nobody should use Emacs threads for any purpose, and threads should disabled at compile time

@kiennq
Copy link
Member

kiennq commented May 12, 2020

Let me try some prototype for that.

Since Emacs is basically single thread, maybe even with data races problem pointed by TSan, it's still good to use now, who knows 😄

@harismandal
Copy link
Contributor

Can watchman be used for file watching? Maybe only if it's available on the system.

@yyoncho
Copy link
Member Author

yyoncho commented May 19, 2020

Can watchman be used for file watching? Maybe only if it's available on the system.

Probably, someone has to investigate that.

@yyoncho yyoncho added this to the 7.0 milestone Jul 1, 2020
@ericdallo ericdallo modified the milestones: 7.0, Next release Jul 1, 2020
@kiennq
Copy link
Member

kiennq commented Jul 16, 2020

Add one more comment to this, I surprise that this works and non-blocking

(make-thread (lambda ()
               (url-copy-file "https://speed.hetzner.de/100MB.bin" "~/tmp/a.tmp")
               (message "done!")))

Always thought that without yielding, the message will never be output.

yyoncho added a commit to yyoncho/lsp-mode that referenced this issue Jul 23, 2020
yyoncho added a commit to yyoncho/lsp-mode that referenced this issue Jul 23, 2020
yyoncho added a commit to yyoncho/lsp-mode that referenced this issue Jul 23, 2020
yyoncho added a commit to yyoncho/lsp-mode that referenced this issue Jul 23, 2020
yyoncho added a commit that referenced this issue Jul 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants