Packaging OOM silently fails and does *not* exit with error code
Pre-flight checklist
- [x] I have read the contribution documentation for this project.
- [x] I agree to follow the code of conduct that this project uses.
- [x] I have searched the issue tracker for a bug that matches the one I want to file, without success.
Forge version
7.8.0
Electron version
35.1.4
Operating system
using Mac, Windows and Linux OS from https://github.com/actions/runner-images
Last known working Forge version
No response
Expected behavior
If there's an error running electron-forge publish it should exit with an error code
Actual behavior
I've seen this happen multiple times where electron-forge publish has an error and instead of exiting with an error code, it simply just ends with exit code 0 and doesn't actually publish the artifact.
Here's an example from my project: https://github.com/dyad-sh/dyad/actions/runs/16395872602/job/46328291961
Here's the error stack trace (note that the workflow step does not fail because electron-forge publish is (surprisingly!) not exiting with an error code:
❯ [plugin-vite] Building vite bundles
vite v5.4.19 building for production...
Vite does not support "rollupOptions.output.sourcemap". Please use "build.sourcemap" instead.
vite v5.4.19 building for production...
vite v5.4.19 building for production...
vite v5.4.19 building for production...
transforming...
transforming...
transforming...
transforming...
✓ 1 modules transformed.
rendering chunks...
computing gzip size...
.vite/build/preload.js 2.59 kB │ gzip: 0.99 kB
✓ built in 396ms
✓ 3 modules transformed.
rendering chunks...
computing gzip size...
.vite/build/tsc_worker.js 6.03 kB │ gzip: 2.30 kB │ map: 27.82 kB
✓ built in 1.91s
✓ 1100 modules transformed.
rendering chunks...
computing gzip size...
.vite/build/main.js 2,577.27 kB │ gzip: 570.76 kB │ map: 13,217.69 kB
✓ built in 9.11s
<--- Last few GCs --->
[2589:0x158008000] 43652 ms: Mark-Compact (reduce) 2033.5 (2076.7) -> 2033.4 (2076.7) MB, 759.79 / 0.00 ms (average mu = 0.104, current mu = 0.000) last resort; GC in old space requested
[2589:0x158008000] 44148 ms: Mark-Compact (reduce) 2033.4 (2076.7) -> 2033.4 (2076.7) MB, 496.79 / 0.00 ms (average mu = 0.063, current mu = 0.000) last resort; GC in old space requested
<--- JS stacktrace --->
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
----- Native stack trace -----
1: 0x102cb55b8 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
2: 0x102e73968 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
3: 0x1030770a0 v8::internal::MemoryController<v8::internal::V8HeapTrait>::MinimumAllocationLimitGrowingStep(v8::internal::Heap::HeapGrowingMode) [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
4: 0x10305a5a8 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
5: 0x10304d9d8 v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithFiller(v8::internal::Handle<v8::internal::Map>, int, v8::internal::Handle<v8::internal::Oddball>, v8::internal::AllocationType) [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
6: 0x10333f86c v8::internal::Handle<v8::internal::NumberDictionary> v8::internal::HashTable<v8::internal::NumberDictionary, v8::internal::NumberDictionaryShape>::EnsureCapacity<v8::internal::Isolate>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::NumberDictionary>, int, v8::internal::AllocationType) [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
7: 0x1033400f4 v8::internal::Handle<v8::internal::NumberDictionary> v8::internal::Dictionary<v8::internal::NumberDictionary, v8::internal::NumberDictionaryShape>::Add<v8::internal::Isolate>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::NumberDictionary>, unsigned int, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyDetails, v8::internal::InternalIndex*) [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
8: 0x103212e48 v8::internal::(anonymous namespace)::DictionaryElementsAccessor::AddImpl(v8::internal::Handle<v8::internal::JSObject>, unsigned int, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, unsigned int) [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
9: 0x1032d6928 v8::internal::JSObject::AddDataElement(v8::internal::Handle<v8::internal::JSObject>, unsigned int, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes) [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
10: 0x103351b48 v8::internal::Object::AddDataProperty(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::Maybe<v8::internal::ShouldThrow>, v8::internal::StoreOrigin, v8::internal::EnforceDefineSemantics) [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
11: 0x10346ec78 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::StoreOrigin, v8::Maybe<v8::internal::ShouldThrow>) [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
12: 0x10346fce0 v8::internal::Runtime_SetKeyedProperty(int, unsigned long*, v8::internal::Isolate*) [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
13: 0x1037fcc44 Builtins_CEntry_Return1_ArgvOnStack_NoBuiltinExit [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
14: 0x1091caa04
15: 0x108c5b6dc
16: 0x103814b3c Builtins_ArrayForEach [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
17: 0x1037743e4 Builtins_InterpreterEntryTrampoline [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
18: 0x1037743e4 Builtins_InterpreterEntryTrampoline [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
19: 0x1037743e4 Builtins_InterpreterEntryTrampoline [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
20: 0x1037ab210 Builtins_AsyncFunctionAwaitResolveClosure [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
21: 0x103858fb8 Builtins_PromiseFulfillReactionJob [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
22: 0x10379ab94 Builtins_RunMicrotasks [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
23: 0x1037723f4 Builtins_JSRunMicrotasksEntry [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
24: 0x102fec22c v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
25: 0x102fecb58 v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
26: 0x102fecd44 v8::internal::Execution::TryRunMicrotasks(v8::internal::Isolate*, v8::internal::MicrotaskQueue*) [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
27: 0x103017a34 v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*) [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
28: 0x1030181c0 v8::internal::MicrotaskQueue::PerformCheckpoint(v8::Isolate*) [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
29: 0x102bccc84 node::InternalCallbackScope::Close() [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
30: 0x102bcc824 node::CallbackScope::~CallbackScope() [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
31: 0x102c7df24 (anonymous namespace)::uvimpl::Work::AfterThreadPoolWork(int) [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
32: 0x102c7e340 node::ThreadPoolWork::ScheduleWork()::'lambda'(uv_work_s*, int)::operator()(uv_work_s*, int) const [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
33: 0x102c7e1f4 node::ThreadPoolWork::ScheduleWork()::'lambda'(uv_work_s*, int)::__invoke(uv_work_s*, int) [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
34: 0x10374d500 uv__work_done [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
35: 0x103750f28 uv__async_io [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
36: 0x103763bd0 uv__io_poll [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
37: 0x103751490 uv_run [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
38: 0x102bcd7e8 node::SpinEventLoopInternal(node::Environment*) [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
39: 0x102cf9eec node::NodeMainInstance::Run() [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
40: 0x102c77cfc node::Start(int, char**) [/Users/runner/hostedtoolcache/node/20.19.3/arm64/bin/node]
41: 0x184d5b154 start [/usr/lib/dyld]
Steps to reproduce
Introduce some kind of issue in the publish step (e.g. cause an Out of Memory error by under-provisioning the RAM needed to compile an electron project).
Additional information
No response
Hey @wwwillchen, thanks for the report. Based on the logs, this seems to be failing at the Vite build step before packaging starts. I'll update the issue title accordingly.
Did https://github.com/dyad-sh/dyad/pull/680 work to prevent future OOM errors btw?
@erickzhao we did by allocating more memory to node.js https://github.com/dyad-sh/dyad/blob/6e4eb7c46b1a274410b3fcd10a47063e68e5a062/.github/workflows/release.yml#L68
I also ended up creating a script that I run as part of my GitHub release workflow to ensure that all the binaries are there, e.g. https://github.com/dyad-sh/dyad/blob/main/scripts/verify-release-assets.js, so this issue isn't super pressing for me now, but was pretty surprising when it first happened
Yeah, I can see how it's pretty poor UX. I'm surprised it didn't fail, either.
BTW, if you're building in CI, you can use the --dry-run and --from-dry-run flags to combine your publish step into a single job.
Documentation is a bit sparse but here are some references:
- Docs: https://www.electronforge.io/cli#usage-4
- Example in Electron Fiddle: https://app.circleci.com/pipelines/github/electron/fiddle/1892/workflows/082cdb36-63c4-4d5f-aded-89a777495e0e
Hey @wwwillchen, I don't have an update on the exit code issue, but the next version of Electron Forge will allow you to set a max concurrency limit for Vite so you're less likely to run into OOM issues with multiple renderer targets: https://github.com/electron/forge/pull/3990
@erickzhao thanks for the update. also thanks for the earlier message on --dry-run and --from-dry-run this is definitely better than what I was doing because I was getting a race condition with different jobs creating a github release 😅