Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 586248

Summary: app-editors/neovim merging hangs while generating helptags
Product: Gentoo Linux Reporter: anoteros <anoteros>
Component: Current packagesAssignee: Vim Maintainers <vim>
Status: RESOLVED FIXED    
Severity: normal CC: bearcatsandor, christopher.paul.hanson, g2boojum, gmt, holgersson, iskatu, jstein, Letto2, mail, maksbotan, mozilla, nvinson234, pageexec
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
URL: https://github.com/neovim/neovim/issues/4920
Whiteboard:
Package list:
Runtime testing required: ---

Description anoteros 2016-06-18 02:46:21 UTC
Merging app-edits/neovim hangs permanently while generating helptags. All versions in the portage tree are affected, including the live ebuild. However, building directly from neovim/neovim git repo works fine.

The command causing the hang is "nvim -u NONE -i NONE -e --headless -c helptags ++t . -c quit"

More info can be found at https://github.com/neovim/neovim/issues/4920
Comment 1 anoteros 2016-06-20 14:27:11 UTC
It seems to build find with USE="-jemalloc"
Comment 2 Marcin Kowalski 2016-06-21 13:55:07 UTC
hitting the same thing. I'll try the workaround.
Comment 3 Marcin Kowalski 2016-06-21 13:56:17 UTC
yes, confirming the workaround on my end.
Comment 4 nvinson234 2016-06-22 13:25:15 UTC
The issue is with libsandbox and libjemalloc.  In short, when jemalloc during jemalloc initialization, jemalloc calls open("/proc/vm/overcommit_memory").  The open call is caught by sandbox.  Sandbox calls dlvsym() to find the real open() function.  dlvsym() calls calloc(), which is jemalloc's calloc(), and calloc(), begins executing (at least part of) jemalloc()'s initialization again.  Finally, the initialization deadlocks because jemalloc was already initializing.

I'm not sure what the fix for this would be, but one idea is to re-implement dl*sym() in sandbox, so these types of problems don't occur.
Comment 5 nvinson234 2016-06-22 14:27:34 UTC
Just wanted to add that Gentoo has seen this before with firefox.  Here's that bug URL: https://bugzilla.mozilla.org/show_bug.cgi?id=435683

It looks like Mozilla fixed their issue by patching jemalloc.
Comment 6 Maxim Koltsov (RETIRED) gentoo-dev 2016-07-03 08:26:39 UTC
I can confirm the bug and workaround.
@mozilla, maybe we should fix jemalloc in portage?
Comment 7 Greg Turner 2016-08-22 21:12:57 UTC
The workaround I've used is to create /etc/portage/env/nosandbox like so:

  FEATURES="${FEATURES} -sandbox -usersandbox"

and then activate this for affected packages, by adding lines like so to /etc/portage/package.env:

  app-editors/neovim nosandbox


Perhaps, like me, some folks will find this slightly less distasteful than opting not to use jemalloc; I guess it might depend on how important paranoia is in your schedule of priorities*.


* If you are truly paranoid, you should probably not be /relying/ on the sandbox feature but using it as a failsafe. It's not even a real sandbox, unless you activate the experimental namespaces feature, and even then, it's not really designed to be an impenetrable security barrier, but more of a QA/bug-catcher mechanism.
Comment 8 Bearcat M. Şándor 2017-01-20 07:50:52 UTC
I can confirm that Greg's fix works well. 

Thank you Greg!
Comment 9 Jory A. Pratt gentoo-dev 2017-08-26 17:56:10 UTC
If you feel I have closed your bug and it is still a current issue, please reopen and update it completely. We will not work bugs that have no ebuild in tree any longer or can not be reproduced with a current system.

Thank You for your support and understanding
The Mozilla Team
Comment 10 Ian Stakenvicius (RETIRED) gentoo-dev 2017-09-02 21:37:15 UTC
still happens, reopening.  workaround isn't a real fix.
Comment 11 Greg Turner 2017-09-02 22:39:23 UTC
(In reply to Ian Stakenvicius from comment #10)
> still happens, reopening.  workaround isn't a real fix.

Fully agreed.  Indeed, "turn off jemalloc helps" is not even a diagnosis, and I see no clear evidence this has to be a bug in jemalloc .. i.e.: it could be a sandbox bug, for example, or the obvious thing: a neovim bug.
Comment 12 Matthew Marchese Gentoo Infrastructure gentoo-dev 2017-11-15 00:21:10 UTC
USE="-jemalloc" worked for me.
Comment 13 Matt Turner gentoo-dev 2022-06-02 11:02:24 UTC
Looks to be long since fixed.