vuedx / languagetools

A collection of tools for better IDE experience.

Home Page:https://vuedx.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: EMFILE: too many open files

EthanHaid opened this issue · comments

Using:
node v16.2.0
npm v7.13.0
vite v2.3.4
WSL2 Ubuntu

Error occurs when I run npm run build. I see my ram slowly fill up, and since I have a fair few imports in my package.json, it reaches 100% and crashes.

I have ulimit -n = 1024, I can raise this but since I'm developing in Docker, I'd rather it just work out of the box.

I found graceful-fs as a potential solution, but I haven't gotten it to work yet

Output:

Unexpected error. Please report 👉 https://github.com/znck/vue-developer-experience/issues/new
[Error: EMFILE: too many open files, open 'dist/assets/vendor.49c28590.js'] {
  errno: -24,
  code: 'EMFILE',
  syscall: 'open',
  path: 'dist/assets/vendor.49c28590.js'
}

<--- Last few GCs --->

[17115:0x5fa39f0]    13950 ms: Mark-sweep 4088.8 (4135.0) -> 4088.8 (4135.0) MB, 21.1 / 0.0 ms  (average mu = 0.943, current mu = 0.289) allocation failure scavenge might not succeed
[17115:0x5fa39f0]    13974 ms: Mark-sweep 4095.3 (4141.5) -> 4095.3 (4141.5) MB, 18.6 / 0.0 ms  (average mu = 0.904, current mu = 0.218) allocation failure scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0xb14d40 node::Abort() [node]
 2: 0xa31e30 node::FatalError(char const*, char const*) [node]
 3: 0xcfb92e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0xcfbca7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0xee5f45  [node]
 6: 0xef4cc1 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
 7: 0xef7f1c v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
 8: 0xebbdc5 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [node]
 9: 0xeb4934 v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawWithImmortalMap(int, v8::internal::AllocationType, v8::internal::Map, v8::internal::AllocationAlignment) [node]
10: 0xeb6be1 v8::internal::FactoryBase<v8::internal::Factory>::NewRawTwoByteString(int, v8::internal::AllocationType) [node]
11: 0xebd9fc v8::internal::Factory::NewStringFromUtf8(v8::internal::Vector<char const> const&, v8::internal::AllocationType) [node]
12: 0xd0a840 v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int) [node]
13: 0xbfbd49  [node]
14: 0xaefb55  [node]
15: 0xd627db  [node]
16: 0xd63c7c  [node]
17: 0xd642f6 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]
18: 0x1611ad9  [node]
Aborted

Ok, looks like i just need to be more careful about importing my larger modules as async components, and everything builds properly now.

Leaving issue open because I think this error reporting can be improved.