oni icon indicating copy to clipboard operation
oni copied to clipboard

OSX - 0.3.6 - Crash on MacOS earlier than 10.12

Open bryphe opened this issue 6 years ago • 22 comments

Oni Version: 0.3.6 Neovim Version (Linux only): 0.3.0 Operating System: OSX

Issue: Crash on start on OSX, depending on some configurations. This shows as a misleading "Unable to start Neovim error".

This issue was reported on Twitter here: https://twitter.com/appelgriebsch/status/1010942999210151937 and

However, in the dev tools, we see: image

It appears that there is a crash in or around here: https://github.com/onivim/oni/blob/e46c720fc82f1466347016bc0916a8d744c94793/browser/src/neovim/NeovimInstance.ts#L681

The purpose of this _checkAndFixIfBlocked is to handle the case where there was an error spinning up nvim while loading the config - you'd get a blank screen and a 'Press enter to continue` prompt, which was really confusing for users if their config was incompatible - so we tried to provide a better experience by capturing the error and showing a notification.

We don't see the nvim_get_mode call return in this case, so it seems likely that our call to nvim_get_mode is crashing the process. cc @justinmk - maybe you have some ideas here too, if anything changed?

** Workaround: **

Until this is fixed, there are a couple of options:

  • Disable the init.vim - ideally, we could figure out what cases are causing this.
  • Downgrade to an earlier version of nvim - you can set the debug.neovimPath to point to an 0.2.2 version of nvim.

Steps to reproduce:

@CrossR was able to reproduce this on OSX with his configuration: https://github.com/CrossR/dotfiles/blob/master/neovim/.config/nvim/init.vim

In addition to fixing this issue, we should also introduce a regression test that validates against a more in-depth config like @CrossR 's

bryphe avatar Jun 24 '18 18:06 bryphe

Also, in theory, this test should be catching stuff like this: https://github.com/onivim/oni/blob/master/test/ci/Neovim.InvalidInitVimHandlingTest.ts

bryphe avatar Jun 24 '18 18:06 bryphe

One other detail - @CrossR mentioned his config works fine on Windows, and this issue does not repro. So it could be an OSX-only issue, although @CrossR has some pieces of his config that are non-windows specific - so those could also be a culprit.

bryphe avatar Jun 24 '18 18:06 bryphe

It also crashes on my system w/o having a custom init.vim file...

screen shot 2018-06-24 at 20 29 27

Looks like the bundled NeoVim binary needs OSX 10.12 to work...

screen shot 2018-06-24 at 20 35 48

As I'm stick to 10.11 El Capitan this won't work for me... :(

appelgriebsch avatar Jun 24 '18 18:06 appelgriebsch

Thanks for the details, @appelgriebsch !

@CrossR saw it might be related to this issue: https://github.com/neovim/neovim/issues/8524

bryphe avatar Jun 24 '18 18:06 bryphe

We should have our CI build test against earlier OSX versions to help guard against this in the future - https://docs.travis-ci.com/user/reference/osx/#OS-X-Version

bryphe avatar Jun 24 '18 18:06 bryphe

I am running OS X 10.11. I have a working install of neovim (from macports) at /opt/local/bin/nvim. I tried setting the environment variable ONI_NEOVIM_PATH to the macports neovim, as recommended for a Linux install, but it did not work. Is there a way to make this work for OS X ?

leebrinton avatar Jun 27 '18 14:06 leebrinton

Same for me, OS X 10.10.5. ONI_NEOVIM_PATH env variable is ignored. I compiled new neovim by using brew install neovim and then executed next commands to replace nvim binary with symlink to working neovim:

cd /Applications/Oni.app/Contents/Resources/app/node_modules/oni-neovim-binaries/bin/nvim-osx64/bin
rm nvim
ln -s $(which nvim) /Applications/Oni.app/Contents/Resources/app/node_modules/oni-neovim-binaries/bin/nvim-osx64/bin/nvim

The thing is that prebuilt neovim binary 0.3.0 also crashes on my machine with same error message as mentioned above.

dmytro-y-dev avatar Jun 27 '18 15:06 dmytro-y-dev

The quickest fix for this is to download nvim 0.2.2 from neovim: https://github.com/neovim/neovim/releases/tag/v0.2.2

Then add to your config.js the following. I did this by just editing the file in vim (its stored in ~/.config/oni/config.js, and an example one can be found here if you don't have one.)

    "debug.neovimPath": "/Users/ryan/Desktop/nvim-osx64/bin/nvim",

You'll want to do it in the config.js not config.tsx since the .tsx one won't be compiled until Oni runs.

That at least gets Oni to launch. I'm having issues with both the nightly release from today as well as the included binary in the release, and building from source. 0.2.2 works fine.

CrossR avatar Jun 30 '18 21:06 CrossR

Downgrading to 0.2.2 sounds like the safest approach for now!

I see two next steps here:

  1. Set up our Mac builds so that we test against an earlier Mac version too, so we can check this in CI
  2. Actually respect the ONI_NEOVIM_PATH environment variable on all platforms, so that it is easier to tweak this

bryphe avatar Jun 30 '18 21:06 bryphe

I've added the CI server settings to my CI PR, using 10.11. We could potentially use 10.10 instead however.

CrossR avatar Jul 02 '18 19:07 CrossR

And the CI build on 10.11 failed due to not being able to load neovim.

The build on 10.12 can be seen here and seems to be doing okay (though the mac CI is flaky at the moment, so it could still fail, but neovim is at least usable.)

CrossR avatar Jul 02 '18 19:07 CrossR

On macOS 10.14 (Mojave) beta, it looks like the neovim binaries (0.3.0, 0.3.1) downloaded from the neovim github releases raise a segmentation fault. Cannot run from the command line, however the same process I'm using (./nvim-osx64/bin/nvim) works for <0.2.2.

There must be some issue with the github releases, because copying and pasting the 0.3.0 release from homebrew into node_modules/oni-neovim-binaries/bin/nvim-osx64/bin allows Oni to run fine.

jordan-arenstein avatar Jul 17 '18 08:07 jordan-arenstein

I've not tried on macOS 10.14 yet, but it looks like with the latest release of NeoVim being merged, 10.11 is working: https://travis-ci.org/onivim/oni/builds/408413986.

CrossR avatar Jul 26 '18 09:07 CrossR

Same issue here with OSX 10.11 and nvim 0.3.0 and 0.3.1 (tried both). Fixed (as explained above) by adding this file https://github.com/onivim/oni/blob/master/configuration/config.default.js in .config/oni/ and adding my nvim path in the "module.exports" section.

"debug.neovimPath": "/usr/local/bin/nvim",

MarcoLosito avatar Jul 31 '18 16:07 MarcoLosito

I've been checking on random CI tests since the merge of neovim 0.3.1, and all so far have been passing on 10.11, so I think its fixed on that now on master. (Not all the builds are passing, but that is more the fault of the flaky CI tests on mac).

When I tried on 10.14, I was still getting errors unfortunately, so we may still have an issue there.

CrossR avatar Jul 31 '18 22:07 CrossR

Reproduced with version 0.3.7 on macOS 10.14 from fresh install via release DMG. No local neovim installed, using packaged version. screen shot 2018-10-20 at 6 21 02 am

kevinchiu avatar Oct 20 '18 13:10 kevinchiu

Same thing happening with me but I have a local neovim as well as a init.vim.

samwightt avatar Nov 16 '18 17:11 samwightt

Latest mojave 10.14.2 here, same issue. Neovim runs fine from terminal, crashes when under onivim.

mikolajpp avatar Dec 14 '18 07:12 mikolajpp

I'm able to reproduce this now after upgrading to mojave. Trying to track this down, a few observations:

  • Running Oni from the command line (open Oni.app) works
  • Running Oni from Finder does not work and exhibits this same failure

Because it works from the command line, a locally built Oni works with yarn launch and yarn start. The problem is not with the Neovim binary bundled in Oni.

I see that there is a difference in the PATH passed to the app via process.env.Path in the command line / Finder case - perhaps that difference is impacting this.

bryphe avatar Dec 14 '18 20:12 bryphe

Finally found the issue with mojave - it's related to this Neovim issue: https://github.com/neovim/neovim/commit/57acfceabeb349377ce244de9b67732b21ed1d18

It seems that the LANG environment variable isn't provided by default when launching from Finder in Mojave, and so that crash was getting hit. Locally, if I had that environment variable to spawn Neovim, life is good again.

bryphe avatar Dec 14 '18 22:12 bryphe

However, trying to launch oni from the terminal and verifying that LANG is indeed set still result in the crash for me. Do we have any workaround for this?

mikolajpp avatar Dec 18 '18 07:12 mikolajpp

Ok, suddenly it works now. Here is what has worked for me.

  1. Paste
export LC_ALL=en_US.UTF-8  
export LANG=en_US.UTF-8

into ~/.profile

  1. Source the profile file
. ~/.profile

from ~/.bash_login

  1. Logout, and verify in the terminal with locale command that LANG is not empty.
  2. Launch oni from terminal.

mikolajpp avatar Dec 18 '18 07:12 mikolajpp