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

Fetching OTP docs fails for some functions #754

Closed
robertoaloi opened this issue May 23, 2020 · 6 comments · Fixed by #804
Closed

Fetching OTP docs fails for some functions #754

robertoaloi opened this issue May 23, 2020 · 6 comments · Fixed by #804
Labels
bug Something isn't working

Comments

@robertoaloi
Copy link
Member

  • gen_server:call
  • io:format
Reason:     {function_clause,[{shell_docs,get_bullet,[[l],undefined],[{file,"shell_docs.erl"},{line,779}]},{shell_docs,render_element,5,[{file,"shell_docs.erl"},{line,700}]},{lists,mapfoldl,3,[{file,"lists.erl"},{line,1354}]},{shell_docs,render_element,5,[{file,"shell_docs.erl"},{line,639}]},{lists,mapfoldl,3,[{file,"lists.erl"},{line,1354}]},{lists,mapfoldl,3,[{file,"lists.erl"},{line,1355}]},{shell_docs,render_docs,3,[{file,"shell_docs.erl"},{line,577}]},{shell_docs,render_headers_and_docs,3,[{file,"shell_docs.erl"},{line,538}]}]}
     Offender:   [{pid,<0.184.0>},{id,els_hover_provider},{mfargs,{els_provider,start_link,[els_hover_provider]}},{restart_type,permanent},{shutdown,brutal_kill},{child_type,worker}]

Other similar functions such as gen_server:cast work fine.

@robertoaloi robertoaloi added the bug Something isn't working label May 23, 2020
alanz added a commit that referenced this issue Oct 29, 2020
Otherwise erlang_ls crashes on certain hover requests.

This is an emergency fix against the 0.4.1 branch
@alanz
Copy link
Contributor

alanz commented Oct 29, 2020

I am getting this problem too, with OTP 23.1.1. In erlang_ls.erl, I log

[info] <0.9.0>@erlang_ls:main:25 io:getopts: [[{binary,true},{encoding,latin1}]]

@alanz
Copy link
Contributor

alanz commented Oct 29, 2020

And the emergency workaround we are deploying internally is 1939063, which just disables use of the shell docs.

@garazdawi
Copy link
Contributor

This has to do with trying to detect if the printing shell supports unicode in order to print nice unicode bullet-points :). The call that is made is io:getopts() which is expected to return a property list with {encoding,latin1|unicode} in it. Which process is the group_leader of the process that you are calling the render function from?

@robertoaloi
Copy link
Member Author

Of course! And since for the STDIO transport we use a noop group leader, the response to a getopts request is hard-coded to an empty list:

From ! {io_reply, ReplyAs, []};

@garazdawi
Copy link
Contributor

I will add options to shell_docs:render so that you can control that via options instead of reading it from the group leader. I'll put it into OTP-23.2, so for releases before that you need to work with the group leader and return an encoding.

@alanz
Copy link
Contributor

alanz commented Oct 30, 2020

Of course! And since for the STDIO transport we use a noop group leader, the response to a getopts request is hard-coded to an empty list:

Could we use the original values (from the spawning process) instead?

alanz added a commit that referenced this issue Oct 30, 2020
Otherwise the shell_docs:render does not receive an encoding, and causes a crash
when requesting information for hover requests.

Closes #754
robertoaloi added a commit that referenced this issue Oct 31, 2020
[#754] Return the original io:getopts/0 values in noop_group_leader.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants