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

Node OOM error with v0.47 #1931

Closed
pheuter opened this issue Nov 29, 2022 · 4 comments · Fixed by #1935
Closed

Node OOM error with v0.47 #1931

pheuter opened this issue Nov 29, 2022 · 4 comments · Fixed by #1935

Comments

@pheuter
Copy link

pheuter commented Nov 29, 2022

After upgrading to UnoCSS v0.47.1 my vite build now throws an OOM exception and never completes (see error below).

If I comment out presetIcons() from plugins: [UnoCSS({presets: []})] then the build succeeds. It appears that some recent change that affects how @unocss/preset-icons works is causing the build to run out of memory.


12:11:22 PM [vite-plugin-svelte] dom compile done.
package                         files     time     avg
@careswitch/v2                     52    0.76s  14.6ms
svelecte                            6    0.15s  24.2ms
svelte-tiny-virtual-list            1   15.8ms  15.8ms
@sveltejs/kit                       1    3.8ms   3.8ms

<--- Last few GCs --->

[60094:0x130078000]     7701 ms: Mark-sweep 3975.6 (4129.2) -> 3975.5 (4126.7) MB, 69.1 / 0.0 ms  (average mu = 0.792, current mu = 0.202) allocation failure; scavenge might not succeed
[60094:0x130078000]     7825 ms: Mark-sweep 3983.0 (4134.4) -> 3983.0 (4150.2) MB, 121.2 / 0.0 ms  (average mu = 0.532, current mu = 0.023) allocation failure; scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0x104456c88 node::Abort() [/opt/homebrew/Cellar/node/19.1.0/bin/node]
 2: 0x104457f54 node::ModifyCodeGenerationFromStrings(v8::Local<v8::Context>, v8::Local<v8::Value>, bool) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
 3: 0x1045b1648 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
 4: 0x1045b15f4 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
 5: 0x104749678 v8::internal::Heap::GarbageCollectionReasonToString(v8::internal::GarbageCollectionReason) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
 6: 0x104748ff0 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
 7: 0x10473ea4c v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
 8: 0x10473f1ac v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
 9: 0x1047239b0 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
10: 0x10471a804 v8::internal::MaybeHandle<v8::internal::SeqOneByteString> v8::internal::FactoryBase<v8::internal::Factory>::NewRawStringWithMap<v8::internal::SeqOneByteString>(int, v8::internal::Map, v8::internal::AllocationType) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
11: 0x104726090 v8::internal::Factory::NewStringFromUtf8(v8::base::Vector<unsigned char const> const&, unibrow::Utf8Variant, v8::internal::AllocationType) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
12: 0x1045d01f0 v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
13: 0x10451c624 node::(anonymous namespace)::MakeString(v8::Isolate*, char const*, unsigned long, node::encoding) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
14: 0x10451c52c node::StringDecoder::DecodeData(v8::Isolate*, char const*, unsigned long*) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
15: 0x10451c944 node::(anonymous namespace)::DecodeData(v8::FunctionCallbackInfo<v8::Value> const&) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
16: 0x104239e18 Builtins_CallApiCallback [/opt/homebrew/Cellar/node/19.1.0/bin/node]
17: 0x10c3fb0e4 
18: 0x10c3f8f48 
19: 0x10426b7b4 Builtins_AsyncFunctionAwaitResolveClosure [/opt/homebrew/Cellar/node/19.1.0/bin/node]
20: 0x104305a98 Builtins_PromiseFulfillReactionJob [/opt/homebrew/Cellar/node/19.1.0/bin/node]
21: 0x10425cc54 Builtins_RunMicrotasks [/opt/homebrew/Cellar/node/19.1.0/bin/node]
22: 0x1042363c4 Builtins_JSRunMicrotasksEntry [/opt/homebrew/Cellar/node/19.1.0/bin/node]
23: 0x1046d07e4 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
24: 0x1046d0da0 v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
25: 0x1046f34b0 v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
26: 0x1046f32e0 v8::internal::MicrotaskQueue::PerformCheckpointInternal(v8::Isolate*) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
27: 0x104390af4 node::InternalCallbackScope::Close() [/opt/homebrew/Cellar/node/19.1.0/bin/node]
28: 0x104451550 node::fs::FSReqPromise<node::AliasedBufferBase<long long, v8::BigInt64Array, void> >::Resolve(v8::Local<v8::Value>) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
29: 0x10445f4c0 node::fs::AfterInteger(uv_fs_s*) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
30: 0x104450e1c node::MakeLibuvRequestCallback<uv_fs_s, void (*)(uv_fs_s*)>::Wrapper(uv_fs_s*) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
31: 0x106c1aff8 uv__work_done [/opt/homebrew/Cellar/libuv/1.44.2/lib/libuv.1.dylib]
32: 0x106c1e3d0 uv__async_io [/opt/homebrew/Cellar/libuv/1.44.2/lib/libuv.1.dylib]
33: 0x106c2e1e0 uv__io_poll [/opt/homebrew/Cellar/libuv/1.44.2/lib/libuv.1.dylib]
34: 0x106c1e7d0 uv_run [/opt/homebrew/Cellar/libuv/1.44.2/lib/libuv.1.dylib]
35: 0x1043918b8 node::SpinEventLoopInternal(node::Environment*) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
36: 0x104498348 node::NodeMainInstance::Run(node::ExitCode*, node::Environment*) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
37: 0x104497fac node::NodeMainInstance::Run() [/opt/homebrew/Cellar/node/19.1.0/bin/node]
38: 0x10441fcd0 node::LoadSnapshotDataAndRun(node::SnapshotData const**, node::InitializationResultImpl const*) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
39: 0x10441fe30 node::Start(int, char**) [/opt/homebrew/Cellar/node/19.1.0/bin/node]
40: 0x198c03e50 start [/usr/lib/dyld]
zsh: abort      npm run build
@sibbng
Copy link
Member

sibbng commented Nov 29, 2022

Should be because of #1926.

We could move the icons layer out of renderChunk hook. I will look into it.

@sibbng
Copy link
Member

sibbng commented Nov 30, 2022

I couldn't create a reproduction that works with v46 but not v47. It could be related to a specific @sveltejs/kit plugin.

I need a reproduction.

@pheuter
Copy link
Author

pheuter commented Nov 30, 2022

@sibbng Here's a repro: https://github.com/pheuter/unocss-memory-repro

I created artificially large amount of files, but if you downgrade UnoCSS to 0.46.5 it's still able to successfully complete npm run build.

@sibbng
Copy link
Member

sibbng commented Nov 30, 2022

Thanks for the reproduction 🙏 I made a PR to fix it: #1935

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants