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

neovim does not work on macOS 10.12 Sierra #18466

Closed
kirelagin opened this issue Sep 9, 2016 · 26 comments
Closed

neovim does not work on macOS 10.12 Sierra #18466

kirelagin opened this issue Sep 9, 2016 · 26 comments
Labels
0.kind: bug Something is broken 6.topic: darwin Running or building packages on Darwin

Comments

@kirelagin
Copy link
Member

› ./bin/nvim
nvim(39665,0x7fffd29413c0) malloc: *** malloc_zone_unregister() failed for 0x7fffd2937000

This is jemalloc/jemalloc#420.

For some reason, neovim installed from Homebrew works just fine, even though I can’t see any Sierra specific changes to the neovim or jemalloc formulas. Need to investigate.

/cc @copumpkin @matthewbauer

@copumpkin
Copy link
Member

Might have something to do with the hardening flags? Just an unfounded thought though...

@kirelagin
Copy link
Member Author

Hm, according to Homebrew/homebrew-core#1957 jemalloc is actually broken in Homebrew right now. So the real question is: how on Earth does neovim from Homebrew work 😕.

@kirelagin
Copy link
Member Author

Ok, I see. neovim from Homebrew does not use jemalloc. They list it as a resource, but, apparently, it is not enough to make it actually use it (I have no idea how formulas work). That is, the binary is not linked against jemalloc.

@copumpkin
Copy link
Member

What's the benefit of linking to it? Can we just stop doing that until they fix upstream?

@copumpkin copumpkin added 0.kind: bug Something is broken 6.topic: darwin Running or building packages on Darwin labels Sep 9, 2016
@kirelagin
Copy link
Member Author

As far as I understand, it’s simply that jemalloc is superior. By dropping it we lose just, you know, its superiority 😎. Other than that, it should be fine.

As a side note, I still do not understand completely how this works. I checked older discussions on the Homebrew formula repository and, it seems, their neovim is supposed to use jemalloc, even though it is not mentioned in the formula apart from the resources section. In neovim’s CMakeLists.txt jemalloc enabled by default indeed. But I see what I see: it does not use it.

@copumpkin
Copy link
Member

Weird! Maybe worth a bug report to homebrew too? Thanks for testing all this stuff by the way. Feel free to drop by ##nix-darwin on freenode for more interactive conversation (although it's often quiet)

@kirelagin
Copy link
Member Author

For future reference: neovim/homebrew-neovim#178.

@vcunat
Copy link
Member

vcunat commented Sep 9, 2016

Perhaps remove darwin from jemalloc.meta.platfoms?

@vcunat
Copy link
Member

vcunat commented Sep 9, 2016

... so that people get an evaluation-time hint that it's likely to be problematic.

@kirelagin
Copy link
Member Author

Would it be possible to do this in a more granular way?
The problems arise exclusively on Sierra, which is, strictly speaking, still in beta (so is problematics by assumption). Even after its release on September 20 it doesn’t make much sense to scare users of all the older versions.

@vcunat
Copy link
Member

vcunat commented Sep 9, 2016

Ah, I thought it was independent of version. I don't think nixpkgs has the information about the host OS version during evaluation. Actually, I don't think it should have the information in any phase, due to purity, but I should mainly just stop putting my nose in Darwin stuff as I don't understand it...

@copumpkin
Copy link
Member

No, I agree, I don't think we should be doing anything conditionally on host OS version. If we can't use jemalloc, let's just turn it off on darwin until we can. Or statically link the way homebrew does it, or whatever.

@zchee
Copy link

zchee commented Sep 13, 2016

@kirelagin Sorry, this threads is already understood cause?
If not, See jemalloc/jemalloc#427.

FYI, I was tried use tcmalloc instead of jemalloc(in another matter) for Neovim, but same results.
Also solved the same patch, See gperftools/gperftools#827.

It's on the native Darwin. I have not used NixOS.
If this thread talking about the different topic, sorry, ignore it.

@nhooyr
Copy link
Contributor

nhooyr commented Oct 11, 2016

Related issue: neovim/neovim#5415

@nhooyr
Copy link
Contributor

nhooyr commented Oct 12, 2016

For anyone facing this issue now, just create ~/.nixpkgs/config.nix with

{
  packageOverrides = pkgs: {
    neovim = pkgs.neovim.override {
      withJemalloc = false;
    };
  };
}

@Mic92
Copy link
Member

Mic92 commented Oct 22, 2016

withJemalloc could be made false by default on darwin then.

@kirelagin
Copy link
Member Author

We can simply wait for jemalloc 4.3.0. Hopefully, it will happen soon (jemalloc/jemalloc#453).

@plitzenberger
Copy link

@nhooyr This override works for me but now I get clipboard: error: on startup and every time I yank something.

It only happens when: set clipboard=unnamed

calling function provider#clipboard#Call('set', [['TEST COPY STRING', ''], 'V', '*'])

line 1:   return call(s:clipboard[a:method],a:args,s:clipboard)
calling function provider#clipboard#Call[1]..333(['TEST COPY STRING', ''], 'V', '*')

line 1:   if a:reg == '"'
line 2:     call s:clipboard.set(a:lines,a:regtype,'+')
line 3:     if s:copy['*'] != s:copy['+']
line 4:       call s:clipboard.set(a:lines,a:regtype,'*')
line 5:     end
line 6:     return 0
line 7:   end
line 8:   if s:cache_enabled == 0
line 9:     call s:try_cmd(s:copy[a:reg], a:lines)
calling function provider#clipboard#Call[1]..333[9]..<SNR>220_try_cmd('pbcopy', ['TEST COPY STRING', ''])

line 1:   let argv = split(a:cmd, " ")
line 2:   let out = a:0 ? systemlist(argv, a:1, 1) : systemlist(argv, [''], 1)
line 3:   if v:shell_error
line 4:     echohl WarningMsg
line 5:     echo "clipboard: error: ".(len(out) ? out[0] : '')
clipboard: error:
line 6:     echohl None
line 7:     return 0
function provider#clipboard#Call[1]..333[9]..<SNR>220_try_cmd returning #0

continuing in function provider#clipboard#Call[1]..333

line 10:     return 0
function provider#clipboard#Call[1]..333 returning #0

continuing in function provider#clipboard#Call

function provider#clipboard#Call returning #0

@plitzenberger
Copy link

It only happens while vim running inside tmux session.

@nhooyr
Copy link
Contributor

nhooyr commented Oct 29, 2016

@plitzenberger create an issue on the neovim repo.

@nhooyr
Copy link
Contributor

nhooyr commented Oct 29, 2016

Or actually, try this first (~/.nixpkgs/config.nix):

{
  packageOverrides = pkgs: {
    neovim = pkgs.lib.overrideDerivation (pkgs.neovim.override {
      withJemalloc = false;
    }) (attrs: rec {
      name = "neovim-${version}-dev";
      version = "0.1.6";
      src = pkgs.fetchFromGitHub {
        owner = "neovim";
        repo = "neovim";
        rev = "79d77da8a06bf91a77cc96a1f1fba30bbd991a23";
        sha256 = "14gir9sdiddyr0yhnnrn0jrxgyhk8nnlhnqp68wk97q1a9b4x58d";
      };
    });
  };
}

kirelagin added a commit to kirelagin/nixpkgs that referenced this issue Nov 12, 2016
@vcunat vcunat closed this as completed in fcfe3c0 Nov 19, 2016
@bhipple
Copy link
Contributor

bhipple commented Dec 7, 2016

Is anyone else still having this issue? I'm a relative nix beginner, but I've tried various combinations of the config.nix suggestion posted by nhooyr without luck (with or without Jemalloc 4.3.1).

What I've done so far:

$ nix-channel --update
$ nix-env -u
$ nix-env -i neovim

with a package override building neovim-0.1.7 with and without jeMalloc (same results). What am I doing wrong?

@LnL7
Copy link
Member

LnL7 commented Dec 7, 2016

It should work, we don't have any Sierra specific issues anymore AFAIK

@kirelagin
Copy link
Member Author

kirelagin commented Dec 7, 2016 via email

@bhipple
Copy link
Contributor

bhipple commented Dec 7, 2016

Nevermind; noobie mistakes on my end. The first time I tried it, I hadn't updated my nix-channel to pull the latest. Then I added the overrides above and updated my nix-channel, at which point I think I was mistakenly pinning to an old version (probably due to a misunderstanding of how to write Nix expressions).

Now I've updated the channel, removed all of my override code, done a fresh neovim install, and everything just works. Thanks for fixing this a few weeks ago 👍

@kirelagin
Copy link
Member Author

Ok, good to know 👌

@JohnRTitor JohnRTitor moved this to Done in Darwin Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 6.topic: darwin Running or building packages on Darwin
Projects
Status: Done
Development

No branches or pull requests

9 participants