Coc.nvim: node out of memory error

Created on 1 Apr 2019  路  24Comments  路  Source: neoclide/coc.nvim

Result from CocInfo
vim version: NVIM v0.4.0-430-g8698830cb
node version: v11.13.0
coc.nvim version: 0.0.64
term: xterm-256color
platform: arch linux

Describe the bug
This crash occurs seemingly randomly when selecting a completion. There are 6G of ram free.
:messages

[coc] server connection lost
[vim-node-coc]: FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: 0x56193fbc9c51 node::Abort() [node]
 2: 0x56193fbcb440 node::OnFatalError(char const*, char const*) [node]
 3: 0x56193fd66162 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0x56193fd663bb v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0x5619400fe183  [node]
 6: 0x561940110af5 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [node]
 7: 0x5619400df148 v8::internal::Factory::AllocateRawArray(int, v8::internal::PretenureFlag) [node]
 8: 0x5619400df664 v8::internal::Factory::NewFixedArrayWithFiller(v8::internal::Heap::RootListIndex, int, v8::internal::Object*, v8::internal::PretenureFlag) [node]
 9: 0x5619400a58af  [node]
10: 0x5619400a5bcf  [node]
11: 0x561940207a8a v8::internal::JSObject::AddDataElement(v8::internal::Handle<v8::internal::JSObject>, unsigned int, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes) [node]
12: 0x56194021cb87 v8::internal::Object::AddDataProperty(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::ShouldThrow, v8::internal::Object
::StoreFromKeyed) [node]
13: 0x56194023ae1a v8::internal::Object::SetProperty(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::LanguageMode, v8::internal::Object::StoreFromKeyed) [node]
14: 0x5619403700a2 v8::internal::Runtime::SetObjectProperty(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object
>, v8::internal::LanguageMode) [node]
15: 0x561940371210 v8::internal::Runtime_SetProperty(int, v8::internal::Object**, v8::internal::Isolate*) [node]
16: 0xb25bbc4fc5d 
Can't reproduce question

Most helpful comment

Try add let g:coc_node_args = ['--max-old-space-size=8192'] to your vimrc.

All 24 comments

Could be bug of nodejs on your system.
Consider specify g:coc_node_path to node lts, I'm using node 11.12.0 but never got this kind of error.

That's what I suspect as well. I switched to lts, will see if there is still an issue.

With node lts v10.15.3

Error detected while processing function coc#rpc#request[2]..<SNR>37_request:
line    7:
ch 3 sent an invalid message, closed.
[coc] server connection lost
[vim-node-coc]: FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: 0x563e3d952ab1 node::Abort() [node]
 2: 0x563e3d952aff  [node]
 3: 0x563e3db08242 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0x563e3db0849b v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0x563e3de9d413  [node]
 6: 0x563e3deafd45 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [node]
 7: 0x563e3de7dc98 v8::internal::Factory::AllocateRawArray(int, v8::internal::PretenureFlag) [node]
 8: 0x563e3de7e114 v8::internal::Factory::NewFixedArrayWithFiller(v8::internal::Heap::RootListIndex, int, v8::internal::Object*, v8::internal::PretenureFlag) [node]
 9: 0x563e3de4414e  [node]
10: 0x563e3de4433f  [node]
11: 0x563e3dfa03e7 v8::internal::JSObject::AddDataElement(v8::internal::Handle<v8::internal::JSObject>, unsigned int, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::ShouldThrow) [node]
12: 0x563e3dfd3f5a v8::internal::Object::SetProperty(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::LanguageMode, v8::internal::Object::StoreFromKeyed) [node]
13: 0x563e3e118e82 v8::internal::Runtime::SetObjectProperty(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::LanguageMode) [node]
14: 0x563e3e119ff0 v8::internal::Runtime_SetProperty(int, v8::internal::Object**, v8::internal::Isolate*) [node]
15: 0x2aa7c045be1d 

Please provide step to reproduce.

@chemzqm I haven't figured out a reliable method of triggering the crash. It's seemingly random rls completions. It happens once every hour or so.

Try add let g:coc_node_args = ['--max-old-space-size=8192'] to your vimrc.

@chemzqm Will do

Still occuring.

[vim-node-coc]: FATAL ERROR: invalid array length Allocation failed - JavaScript heap out of memory
 1: 0x55eaf472dab1 node::Abort() [node]
 2: 0x55eaf472daff  [node]
 3: 0x55eaf48e3242 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0x55eaf48e349b v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0x55eaf4c78413  [node]
 6: 0x55eaf4c58d44 v8::internal::Factory::AllocateRawFixedArray(int, v8::internal::PretenureFlag) [node]
 7: 0x55eaf4c59114 v8::internal::Factory::NewFixedArrayWithFiller(v8::internal::Heap::RootListIndex, int, v8::internal::Object*, v8::internal::PretenureFlag) [node]
 8: 0x55eaf4c1f14e  [node]
 9: 0x55eaf4c1f33f  [node]
10: 0x55eaf4d7b3e7 v8::internal::JSObject::AddDataElement(v8::internal::Handle<v8::internal::JSObject>, unsigned int, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::Sho
uldThrow) [node]
11: 0x55eaf4daef5a v8::internal::Object::SetProperty(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::LanguageMode, v8::internal::Object::StoreFromKeyed) [node]
12: 0x55eaf4ef3e82 v8::internal::Runtime::SetObjectProperty(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object
>, v8::internal::LanguageMode) [node]
13: 0x55eaf4ef4ff0 v8::internal::Runtime_SetProperty(int, v8::internal::Object**, v8::internal::Isolate*) [node]
14: 0x22651a0dbe1d 

Steps to reproduce

Plugins coc-snippets, and coc-rls

use std::cell::UnsafeCell;
fn main() {
    let uc = UnsafeCell::new(Some(0));


}

Type ifl and expand the snippet.

use std::cell::UnsafeCell;
fn main() {
    let uc = UnsafeCell::new(Some(0));

    if let Some(foo) = foo {
        foo.
    }
}

Start typing ref mut in first place holder.

There's no snippet start starts with ifl.

My bad, it's in coc-rls not vim-snippets

Can't reproduce, it works as expected for me.

Still trying to create reproducible a mini vimrc, but the crash occurs when this as mut snippet is in pum.

Never mind just using arrow keys then selecting ifl causes the crash. *Sometimes

Minimal vimrc

call plug#begin()
let g:coc_global_extensions = [
    \ 'coc-snippets',
    \ 'coc-rls'
    \ ]
Plug 'neoclide/coc.nvim', {'do': 'yarn install'}

Plug 'honza/vim-snippets'

set signcolumn=yes
call plug#end()

Minimal coc confg

{
     "suggest.reloadPumOnInsertChar": true,
      "suggest.noselect": false,
}

In new cargo project.
You may have to delete the contents of the file first.
src/main.rs

fn main() {
    // Type "ref "
    ref //crash occurs
}

Still can't reproduce, does it happen when you don't have "suggest.reloadPumOnInsertChar":true?

Removing any of the vimrc or coc setting breaks reproduction. I'm not sure if it fixes the issue, but I will test without suggest.reloadPumOnInsertChar.

Edit: withoutsuggest.reloadPumOnInsertChar this seems to be fixed.

It's back same error. Very different situation. No active snippets.
I updated my neovim today.

This appears to have gotten worse when I updated to today's neovim and coc master.

The bug happens more often when I am in a snippet placeholder and the first suggested completion is another snippet.

Please provide minimal vimrc to reproduce.

I have not found deterministic method of reproduction. I suspect it may have to due with "suggest.noselect": false and coc-snippets handling vim-snippets and coc-rls snippets.
I will test this guess with "snippets.loadFromExtensions": false.

Consider checkout the debug output of coc.nvim: https://github.com/neoclide/coc.nvim/wiki/Debug-coc.nvim.

I suspect it could be problem of infinite TextChange event caused by other vim plugin.

I caught a crash.
Screenshot_20190423_231512

@Avi-D-coder There's no softSplit any more, feel free to reopen it if you got this issue again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cvlmtg picture cvlmtg  路  3Comments

MacGuffinLife picture MacGuffinLife  路  4Comments

lanox picture lanox  路  3Comments

MaskRay picture MaskRay  路  3Comments

tom-james-watson picture tom-james-watson  路  3Comments