-
Notifications
You must be signed in to change notification settings - Fork 136
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
[#518] Replace group leader when using stdio transport #521
Conversation
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.
LGTM
I saw in reading that the group leader is abused to harvest processes when shutting down. Will that be compromised by this? Will it matter, given we shut down the O/S process as a whole when terminating the server?
I don't think it will. The processes that wouldn't be killed are the ones that are not under the supervision tree, as long as every process we spawn is linked to a process in the supervision tree it should be fine.
I agree that it ultimately does not matter for the users. If by any chance some dangling process is still alive when the application is stopped, this could affect some of the tests, depending on what the process does. But this would still happen without the change in this PR. @robertoaloi was having some issues with the process that keeps the TCP connection in his indexing PR. |
Running this under emacs, I get
Bisecting blames 9050e6a |
If possible, I would appreciate @dszoboszlay 's input on this one. |
BTW, the error in emacs is complaining about this line getting hit Line 73 in 9050e6a
|
My setup is mac, catalina, emacs
|
I found the problem! We are using
|
@@ -40,6 +40,8 @@ init([]) -> | |||
, period => 60 | |||
}, | |||
{ok, Transport} = application:get_env(erlang_ls, transport), | |||
%% Restrict access to stdio when using that transport | |||
(Transport =/= els_stdio) andalso restrict_stdio_access(), |
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.
Isn't this the opposite of what you want? You call restrict_stdio_access()
for every transport except for els_stdio
.
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.
It looks like @dszoboszlay is correct. I also suggest we do not rely on the andalso
semantics for this, since it makes the code less readable. I would rather:
restrict_stdio_access(els_stdio) ->
restrict_stdio_access();
restrict_stdio_access(_) ->
ok.
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.
🤦
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.
Fixed by #532
All in all, I don't think you should base your solution on changing the
I'd recommend taking a completely different approach:
P = erlang:open_port({fd, 0, 1}, []),
erlang:port_command(P, <<"hello world!\n">>),
erlang:port_close(P). It is very unlikely that any other library would accidentally write to this port! 😄 |
This version brings approx. 30 new PRs. The highlights are: - Improve map exhaustiveness checking [erlang-ls#524](josefs/Gradualizer#524) by @xxdavid - Fix all remaining self-check errors [erlang-ls#521](josefs/Gradualizer#521) by @erszcz - Fix intersection-typed function calls with union-typed arguments [erlang-ls#514](josefs/Gradualizer#514) by @erszcz - Experimental constraint solver [erlang-ls#450](josefs/Gradualizer#450) by @erszcz
This version brings approx. 30 PRs. The highlights are: - Improve map exhaustiveness checking [erlang-ls#524](josefs/Gradualizer#524) by @xxdavid - Fix all remaining self-check errors [erlang-ls#521](josefs/Gradualizer#521) by @erszcz - Fix intersection-typed function calls with union-typed arguments [erlang-ls#514](josefs/Gradualizer#514) by @erszcz - Experimental constraint solver [erlang-ls#450](josefs/Gradualizer#450) by @erszcz
This version brings approx. 30 PRs. The highlights are: - Improve map exhaustiveness checking [erlang-ls#524](josefs/Gradualizer#524) by @xxdavid - Fix all remaining self-check errors [erlang-ls#521](josefs/Gradualizer#521) by @erszcz - Fix intersection-typed function calls with union-typed arguments [erlang-ls#514](josefs/Gradualizer#514) by @erszcz - Experimental constraint solver [erlang-ls#450](josefs/Gradualizer#450) by @erszcz
This version brings approx. 30 PRs. The highlights are: - Improve map exhaustiveness checking [#524](josefs/Gradualizer#524) by @xxdavid - Fix all remaining self-check errors [#521](josefs/Gradualizer#521) by @erszcz - Fix intersection-typed function calls with union-typed arguments [#514](josefs/Gradualizer#514) by @erszcz - Experimental constraint solver [#450](josefs/Gradualizer#450) by @erszcz
Description
Replace group leader when using stdio transport.
Fixes #518.