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

Edit buffer crashes #86

Closed
romgrk opened this issue Feb 25, 2019 · 8 comments
Closed

Edit buffer crashes #86

romgrk opened this issue Feb 25, 2019 · 8 comments

Comments

@romgrk
Copy link
Contributor

romgrk commented Feb 25, 2019

Steps:

  • Run esy x Oni2
  • Type :e Oni.install

Result: Oni2 crashes
Expected: buffer is opened

Terminal log:

Raw Notification: redraw | [[wildmenu_show,
  [[Oni2.install, Oni2.opam, OniBench.install, OniBench.opam,
    OniUnitTestRunner.install, OniUnitTestRunner.opam, Oni_Core.install,
    Oni_Core.opam, Oni_Neovim.install, Oni_Neovim.opam, Oni_UI.install,
    Oni_UI.opam]]], [wildmenu_select, [0]],
 [cmdline_show, [[[0, e Oni2.install]], 14, :, , 0, 1]], [flush, []]]
[DEBUG - STATE] Mode: commandline editor font measured width: 8 editor font measured height: 16
[DEBUG - STATE] Mode: commandline editor font measured width: 8 editor font measured height: 16
[DEBUG - STATE] Mode: commandline editor font measured width: 8 editor font measured height: 16
[DEBUG - STATE] Mode: commandline editor font measured width: 8 editor font measured height: 16
[DEBUG - STATE] Mode: commandline editor font measured width: 8 editor font measured height: 16
Protocol Notification: unknown
Raw Notification: redraw | [[wildmenu_hide, []], [flush, []]]
Fatal error: exception Failure("hd")
@akinsho
Copy link
Member

akinsho commented Feb 25, 2019

@romgrk I can't reproduce this error on master 🤔, are you seeing or doing anything else also did you run the bootstrap command? What system are you on?

@romgrk
Copy link
Contributor Author

romgrk commented Feb 25, 2019

Yes, I've ran esy install && esy bootstrap && esy build && esy x Oni2 with the master branch just now.

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.10
Release:	18.10
$ esy --version
0.5.6

Not sure how to debug esy's ocaml, but if you have some tips I'd be happy to.

@bryphe
Copy link
Member

bryphe commented Feb 27, 2019

Thanks for logging the issue, @romgrk ! Usually this exception comes from here:

And it means that we didn't get a response from a request we sent to the Neovim API, but we were expecting one. It'd be helpful to log out the methodName in this case to see which request it is failing at (we should also have better logging in general for th is 🤔 )

We saw cases where when it picked up an init.vim and hit issues, but I don't think that is the case here.

It'd be interesting too to run the tests and see if those pass - esy x OniUnitTestRunner.

@tcoopman
Copy link
Contributor

Wouldn't it be interesting to use another list library that doesn't throw on an empty list but returns options, so you are required to handle these cases explicitly. Even though you probably have no very good options here to handle the empty list

@bryphe
Copy link
Member

bryphe commented Feb 27, 2019

Yes, was just thinking about this - we should at the very least check List.length prior to List.hd (or we could create a wrapper List.hd_opt that returns an option), and provide more information here. At the very least - if it could give more details, like "Request 'nvim_open_buf' failed", it might help narrow downt he investigation.

@akinsho
Copy link
Member

akinsho commented Feb 27, 2019

Think we could definitely do this without a new dependency, by wrapping the call in a try and returning None if Not found is raised or returning the values

@tcoopman
Copy link
Contributor

Wouldn't a patternmatch also be a good alternative? switch (list) { | [] => ... | [hd] => ...}

@romgrk
Copy link
Contributor Author

romgrk commented Feb 27, 2019

@bryphe here is the result of the tests: https://gistpreview.github.io/?a07cbe32ba939e9f968e6f1ea157deb4

Logging the method names before the crash says that the last method called is nvim_list_bufs.

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

No branches or pull requests

4 participants