Bug 1983288 - neovim crash on aarch64
Summary: neovim crash on aarch64
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: neovim
Version: 34
Hardware: aarch64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Andreas Schneider
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-07-17 11:31 UTC by Chris Harper
Modified: 2021-08-02 23:07 UTC (History)
6 users (show)

Fixed In Version: neovim-0.5.0-4.fc35 neovim-0.5.0-4.fc34
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-08-02 01:04:58 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
nvim -v output (1.45 KB, text/plain)
2021-07-17 11:31 UTC, Chris Harper
no flags Details
backtrace (2.12 KB, text/plain)
2021-07-17 15:42 UTC, Chris Harper
no flags Details

Description Chris Harper 2021-07-17 11:31:55 UTC
Created attachment 1802648 [details]
nvim -v output

Description of problem:
nvim crashes on aarch64 with Lua issues.

Version-Release number of selected component (if applicable): 
0.5.0-2.fc34 

How reproducible: 
100%

Steps to Reproduce:
1. dnf install neovim
2. nvim -v

Actual results:

Output (attached) contains error

"E5106: Error while creating vim module: vim.lua:85: bad argument #1 to 'insert' (table expected, got nil)"

Expected results:
No errors

Additional info:

Launching nvim and pressing any key crashes nvim with the following being printed: 

"PANIC: unprotected error in call to Lua API (bad argument #-1 (function expected, got nil))"

Clean build from neovim GitHub repo is possible and results in no issues.

Comment 1 Chris Harper 2021-07-17 15:42:02 UTC
Created attachment 1802713 [details]
backtrace

backtrace when launching nvim and hitting enter

Comment 2 Ralph Giles 2021-07-19 17:59:29 UTC
Upstream builds against luajit instead of lua 5.4.3, as does the Fedora package for x86_64 where this bug doesn't manifest.

But building against the system `luajit-2.1.0-0.19beta3.fc34` by adding `aarch64` to the bcond stanze at the top of the spec file fails, despite upstream also using what claims to be 2.1.0-beta3. Perhaps the next step is to figure out what the difference is there; the Fedora luajit has a lot of arch-specific patches.

```
cd /src/neovim-0.5.0/aarch64-redhat-linux-gnu/src/nvim && /usr/bin/luajit /src/neovim-0.5.0/src/nvim/generators/gen_declarations.lua /src/neovim-0.5.0/src/nvim/api/tabpage.c /src/neovim-0.5.0/aarch64-redhat-linux-gnu/src/nvim/auto/api/tabpage.c.generated.h /src/neovim-0.5.0/aarch64-redhat-linux-gnu/include/api/tabpage.h.generated.h /src/neovim-0.5.0/aarch64-redhat-linux-gnu/src/nvim/auto/api/tabpage.i
/usr/bin/luajit: bad light userdata pointer
stack traceback:
	[C]: in function 'match'
	/src/neovim-0.5.0/src/nvim/generators/gen_declarations.lua:252: in main chunk
	[C]: at 0xaaaaddd512d0
gmake[2]: *** [src/nvim/CMakeFiles/nvim.dir/build.make:124: src/nvim/auto/api/tabpage.c.generated.h] Error 1

```

Comment 3 Chris Harper 2021-07-19 21:07:50 UTC
Ive been digging around and confirm the above with building against Luajit (by adding aarch64).

Upstream pull from a newer version of Luajit : https://github.com/neovim/neovim/blob/master/third-party/CMakeLists.txt#L159

I believe this issue is with Luajit on aarch64 (https://github.com/LuaJIT/LuaJIT/pull/230) which was fixed in https://github.com/LuaJIT/LuaJIT/commit/e9af1abec542e6f9851ff2368e7f196b6382a44c or at some other point between packaged Luajit and HEAD.

Neovim previously had calls to lightuserdata which caused issues on aarch64 but these were removed ( https://github.com/neovim/neovim/pull/7880).
Building neovim on aarch64 causes these to be pulled in from Luajit/lua.h causing the compilation issue(not 100% sure).

~/rpmbuild/SPECS grep  -r "lightuserdata" ../BUILD/neovim-0.5.0  *                
../BUILD/neovim-0.5.0/aarch64-redhat-linux-gnu/src/nvim/auto/api/buffer.i:extern void (lua_pushlightuserdata) (lua_State *L, void *p);
../BUILD/neovim-0.5.0/aarch64-redhat-linux-gnu/src/nvim/auto/api/deprecated.i:extern void (lua_pushlightuserdata) (lua_State *L, void *p);

Building Luajit with source from HEAD and no additional patches allows successful neovim compilation but additionally fixes the crash/error reported.

Comment 4 Andreas Schneider 2021-07-22 15:39:09 UTC
luajit doesn't work on aarch64. However we should build neovim against lua 5.1 in this case as neovim only supports 5.1. I've already prepared lua5.1-bit32 but need commit rights for the repo. Once I have builds for that, we can fix neovim.

It looks like there is a bit of development on luajit but there haven't been a release in years. There was a moonjit approach to fix that but this is also dead.

Comment 5 Fedora Update System 2021-07-30 05:52:21 UTC
FEDORA-2021-a441f55415 has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2021-a441f55415

Comment 6 Fedora Update System 2021-07-30 05:52:54 UTC
FEDORA-2021-a441f55415 has been pushed to the Fedora 35 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 7 Fedora Update System 2021-07-30 06:12:15 UTC
FEDORA-2021-fb71ca974a has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-fb71ca974a

Comment 8 Andreas Schneider 2021-07-30 06:13:43 UTC
Could you please test the fedora update mentioned in comment #7 and give positive karma for the bug if it works for you?

Comment 9 Chris Harper 2021-07-30 11:06:30 UTC
Changes in comment #7 fix the issues I originally encountered, thank you.

Comment 10 Andreas Schneider 2021-07-30 16:49:08 UTC
Thanks for testing!

Comment 11 Fedora Update System 2021-08-02 01:04:58 UTC
FEDORA-2021-fb71ca974a has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 12 Ralph Giles 2021-08-02 23:07:11 UTC
I can confirm the package is available in Fedora 34 updates and addresses the issue. Thanks for fixing!


Note You need to log in before you can comment on or make changes to this bug.