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

Segfault with "nvim -u NONE --headless --embed -es" #10031

Closed
blueyed opened this issue May 19, 2019 · 4 comments
Closed

Segfault with "nvim -u NONE --headless --embed -es" #10031

blueyed opened this issue May 19, 2019 · 4 comments
Labels
bug issues reporting wrong behavior complexity:low Low-risk, self-contained. Do NOT ask "can I work on this", just read CONTRIBUTING.md ui
Milestone

Comments

@blueyed
Copy link
Contributor

blueyed commented May 19, 2019

(gdb) bt
#0  0x000055ad021a832a in linecopy (grid=0x55ad02447320 <default_grid>, to=21, from=from@entry=22, col=0, width=width@entry=80) at ../src/nvim/screen.c:6209
#1  0x000055ad021aa0a0 in grid_del_lines (grid=<optimized out>, row=21, line_count=1, end=24, col=<optimized out>, width=80) at ../src/nvim/screen.c:6353
#2  0x000055ad02224064 in msg_scroll_up () at ../src/nvim/message.c:2075
#3  0x000055ad02224263 in msg_puts_display (str=0x7ffe12247a00 "\n", maxlen=-1, attr=0, recurse=0) at ../src/nvim/message.c:1915
#4  0x000055ad02228cca in msg_puts_attr_len (str=str@entry=0x7ffe12247a00 "\n", len=len@entry=-1, attr=attr@entry=0) at ../src/nvim/message.c:1818
#5  0x000055ad02228dbd in msg_puts_attr (s=s@entry=0x7ffe12247a00 "\n", attr=attr@entry=0) at ../src/nvim/message.c:1764
#6  0x000055ad02228f72 in msg_putchar_attr (c=c@entry=10, attr=attr@entry=0) at ../src/nvim/message.c:1259
#7  0x000055ad02228fb2 in msg_putchar (c=c@entry=10) at ../src/nvim/message.c:1244
#8  0x000055ad0222959a in msg_start () at ../src/nvim/message.c:1208
#9  0x000055ad02277e1c in gotocmdline (clr=clr@entry=1) at ../src/nvim/ex_getln.c:3535
#10 0x000055ad0227c2a3 in command_line_enter (firstc=firstc@entry=58, count=count@entry=1, indent=indent@entry=0) at ../src/nvim/ex_getln.c:315
#11 0x000055ad0227c735 in getcmdline (firstc=firstc@entry=58, count=count@entry=1, indent=indent@entry=0) at ../src/nvim/ex_getln.c:2021
#12 0x000055ad0227c78a in getexline (c=58, cookie=<optimized out>, indent=0) at ../src/nvim/ex_getln.c:2205
#13 0x000055ad0228ef87 in do_cmdline (cmdline=<optimized out>, cmdline@entry=0x0, fgetline=0x55ad0227c766 <getexline>, cookie=cookie@entry=0x0, flags=flags@entry=0)
    at ../src/nvim/ex_docmd.c:512
#14 0x000055ad02293113 in do_exmode (improved=<optimized out>) at ../src/nvim/ex_docmd.c:229
#15 0x000055ad02214732 in normal_check (state=0x7ffe122483c0) at ../src/nvim/normal.c:1349
#16 0x000055ad021796e4 in state_enter (s=0x7ffe122483c0) at ../src/nvim/state.c:28
#17 0x000055ad022156d1 in normal_enter (cmdwin=<optimized out>, noexmode=<optimized out>) at ../src/nvim/normal.c:462
#18 0x000055ad0224153d in main (argc=<optimized out>, argv=<optimized out>) at ../src/nvim/main.c:597

Just noticed this when adding -es to a test in Neomake where I am using an embedded Neovim, which apparently hangs due to waiting for hit-Enter (from :echom I've added for debugging).
The test is at https://github.com/neomake/neomake/blob/6e5ff157a678812454d8bf465b630875f9a8c476/tests/compat.vader#L80-L86 - would be interested in how to ignore hit-enter there in general.

NVIM v0.4.0-744-ga541c681f

@justinmk
Copy link
Member

justinmk commented May 19, 2019

For your use-case don't use --embed unless you actually want to connect a UI. --embed causes msg_use_printf() to return false, that's why msg_puts_attr_len calls msg_puts_display.

Meanwhile, there does seem to be a bug here.

@justinmk justinmk added the bug issues reporting wrong behavior label May 19, 2019
@justinmk justinmk added this to the todo milestone May 19, 2019
@justinmk justinmk added the ui label May 19, 2019
blueyed added a commit to neomake/neomake that referenced this issue May 19, 2019
Ref: neovim/neovim#10031 (comment)

With `--embed` it would hang with output during autoload, likely waiting
for an hit-enter prompt (e.g. with `for i in range(0, 10) | echom i | endfor`
in `autoload/neomake/highlights.vim`).
@blueyed
Copy link
Contributor Author

blueyed commented May 19, 2019

@justinmk
Thanks, it seemed like --embed would be a shortcut, but neomake/neomake#2368 appears to work better in this case.

@justinmk justinmk added complexity:low Low-risk, self-contained. Do NOT ask "can I work on this", just read CONTRIBUTING.md help wanted labels May 19, 2019
blueyed added a commit to neomake/neomake that referenced this issue Jun 2, 2019
Ref: neovim/neovim#10031 (comment)

With `--embed` it would hang with output during autoload, likely waiting
for an hit-enter prompt (e.g. with `for i in range(0, 10) | echom i | endfor`
in `autoload/neomake/highlights.vim`).
@glacambre
Copy link
Member

As far as I know there's no way to use stdin as both an msgpack-rpc channel and a regular "textual channel", right? So would fixing this issue be as simple as making neovim print an error message and quit when both --embed and -es are present?

@justinmk
Copy link
Member

making neovim print an error message and quit when both --embed and -es are present?

That makes sense to me. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issues reporting wrong behavior complexity:low Low-risk, self-contained. Do NOT ask "can I work on this", just read CONTRIBUTING.md ui
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants