clients icon indicating copy to clipboard operation
clients copied to clipboard

Bitwarden Web fails building in i686 (Void) Linux chroot

Open TinfoilSubmarine opened this issue 3 years ago • 1 comments

Steps To Reproduce

  1. Run npm ci --ignore-scripts
  2. Run npm run dist:oss:selfhost

Expected Result

Web vault should build successfully.

Actual Result

$ npm run dist:oss:selfhost

> @bitwarden/[email protected] dist:oss:selfhost
> npm run build:oss:selfhost:prod


> @bitwarden/[email protected] build:oss:selfhost:prod
> cross-env ENV=selfhosted NODE_ENV=production npm run build:oss


> @bitwarden/[email protected] build:oss
> webpack

==================================================
envConfig
{
  "urls": {},
  "stripeKey": "pk_test_KPoCfZXu7mznb9uSCPZ2JpTD",
  "braintreeKey": "sandbox_r72q8jq6_9pnxkwm75f87sdc2",
  "paypal": {
    "businessId": "AD3LAUZSNVPJY",
    "buttonAction": "https://www.sandbox.paypal.com/cgi-bin/webscr"
  },
  "dev": {
    "port": 8081,
    "allowedHosts": "auto",
    "proxyApi": "http://localhost:4001",
    "proxyIdentity": "http://localhost:33657",
    "proxyEvents": "http://localhost:46274",
    "proxyNotifications": "http://localhost:61841"
  },
  "flags": {
    "showTrial": false
  }
}
==================================================
[BABEL] Note: The code generator has deoptimised the styling of /builddir/vaultwarden-web-2022.9.1/clients-web-v2022.9.1/node_modules/@angular/core/fesm2020/core.mjs as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /builddir/vaultwarden-web-2022.9.1/clients-web-v2022.9.1/node_modules/zxcvbn/lib/frequency_lists.js as it exceeds the max of 500KB.

<--- Last few GCs --->

[23870:0x58a2f8a0]    87678 ms: Mark-sweep 977.3 (1040.6) -> 969.0 (1042.2) MB, 590.7 / 0.0 ms  (average mu = 0.565, current mu = 0.380) allocation failure scavenge might not succeed
[23870:0x58a2f8a0]    89052 ms: Mark-sweep 988.2 (1053.6) -> 983.4 (1054.3) MB, 1326.0 / 0.0 ms  (average mu = 0.297, current mu = 0.035) allocation failure scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0x56b7a02a node::DumpBacktrace(_IO_FILE*) [webpack]
 2: 0x56c2a4b3 node::Abort() [webpack]
 3: 0x56b094d1 node::FatalError(char const*, char const*) [webpack]
 4: 0x56e53b64 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [webpack]
 5: 0x56e53ebd v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [webpack]
 6: 0x5702beb2  [webpack]
 7: 0x5703ee07  [webpack]
 8: 0x570414bd v8::internal::Heap::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [webpack]
 9: 0x570415a5 v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [webpack]
10: 0x56ffb2c4 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [webpack]
11: 0x56ff1ab8 v8::internal::FactoryBase<v8::internal::Factory>::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [webpack]
12: 0x56ff228a v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawWithImmortalMap(int, v8::internal::AllocationType, v8::internal::Map, v8::internal::AllocationAlignment) [webpack]
13: 0x56ff4cf7 v8::internal::FactoryBase<v8::internal::Factory>::NewRawTwoByteString(int, v8::internal::AllocationType) [webpack]
14: 0x573daac5 v8::internal::IncrementalStringBuilder::Extend() [webpack]
15: 0x57147aba v8::internal::JsonStringifier::SerializeString(v8::internal::Handle<v8::internal::String>) [webpack]
16: 0x57149b20 v8::internal::JsonStringifier::Result v8::internal::JsonStringifier::Serialize_<true>(v8::internal::Handle<v8::internal::Object>, bool, v8::internal::Handle<v8::internal::Object>) [webpack]
17: 0x5714cc2c v8::internal::JsonStringifier::Result v8::internal::JsonStringifier::Serialize_<false>(v8::internal::Handle<v8::internal::Object>, bool, v8::internal::Handle<v8::internal::Object>) [webpack]
18: 0x5714e13e v8::internal::JsonStringifier::Stringify(v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>) [webpack]
19: 0x5714e218 v8::internal::JsonStringify(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>) [webpack]
20: 0x56ee7eec v8::internal::Builtin_JsonStringify(int, unsigned int*, v8::internal::Isolate*) [webpack]
21: 0x57767497  [webpack]
22: 0x57707df2  [webpack]
23: 0x57707df2  [webpack]
24: 0x57707df2  [webpack]
25: 0x57777cf2  [webpack]
26: 0x57707df2  [webpack]
27: 0x577a3cd3  [webpack]
28: 0x57705d30  [webpack]
29: 0x577e23d3  [webpack]
30: 0x57707df2  [webpack]
31: 0x57707df2  [webpack]
32: 0x57730777  [webpack]
33: 0x577a50c3  [webpack]
34: 0x57724ac0  [webpack]
35: 0x577064a5  [webpack]
36: 0x56f9460b  [webpack]
37: 0x56f9501b  [webpack]
38: 0x56f954c0 v8::internal::Execution::TryRunMicrotasks(v8::internal::Isolate*, v8::internal::MicrotaskQueue*, v8::internal::MaybeHandle<v8::internal::Object>*) [webpack]
39: 0x56fc1d5e  [webpack]
40: 0x56fc2108 v8::internal::MicrotaskQueue::PerformCheckpointInternal(v8::Isolate*) [webpack]
41: 0x56b35b86 node::InternalCallbackScope::Close() [webpack]
42: 0x56b36590 node::InternalMakeCallback(node::Environment*, v8::Local<v8::Object>, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context) [webpack]
43: 0x56b50163 node::AsyncWrap::MakeCallback(v8::Local<v8::Function>, int, v8::Local<v8::Value>*) [webpack]
44: 0x56c2ec06 node::fs::FSReqCallback::Resolve(v8::Local<v8::Value>) [webpack]
45: 0x56c309e0 node::fs::AfterNoArgs(uv_fs_s*) [webpack]
46: 0xf7f5c842  [/usr/lib32/libuv.so.1]
npm ERR! Lifecycle script `build:oss:selfhost:prod` failed with error: 
npm ERR! Error: command failed 
npm ERR!   in workspace: @bitwarden/[email protected] 
npm ERR!   at location: /builddir/vaultwarden-web-2022.9.1/clients-web-v2022.9.1/apps/web 
npm ERR! Lifecycle script `dist:oss:selfhost` failed with error: 
npm ERR! Error: command failed 
npm ERR!   in workspace: @bitwarden/[email protected] 
npm ERR!   at location: /builddir/vaultwarden-web-2022.9.1/clients-web-v2022.9.1/apps/web 
[joel@/home/joel/repos/void-packages/masterdir-x86 web]$ npm run build:oss:dev:watch
npm ERR! Lifecycle script `build:oss:dev:watch` failed with error: 
npm ERR! Error: Missing script: "build:oss:dev:watch"

Did you mean one of these?
    npm run build:oss:watch # run the "build:oss:watch" package script
    npm run build:bit:watch # run the "build:bit:watch" package script
    npm run build:bit:dev:watch # run the "build:bit:dev:watch" package script

To see a list of scripts, run:
  npm run 
npm ERR!   in workspace: @bitwarden/[email protected] 
npm ERR!   at location: /builddir/vaultwarden-web-2022.9.1/clients-web-v2022.9.1/apps/web 
npm ERR! Missing script: build:oss:dev:watch

npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/.npm/_logs/2022-09-18T23_14_32_733Z-debug-0.log

Screenshots or Videos

No response

Additional Context

No response

Operating System

Linux

Operating System Version

Void Linux i686 (chroot)

Web Browser

Chrome, Safari, Microsoft Edge, Firefox, Opera, Brave, Vivaldi

Browser Version

No response

Build Version

2022.9.1

TinfoilSubmarine avatar Sep 18 '22 23:09 TinfoilSubmarine

I should point out that I confirmed this wasn't a bug specific to the vaultwarden patches (I ran this without the patch).

TinfoilSubmarine avatar Sep 18 '22 23:09 TinfoilSubmarine

Hey @TinfoilSubmarine I've just ran npm run dist:oss:selfhost and it builds fine on my local environment. The JS heap memory issue indicates there might be an issue with your environment, possible a bugged node/npm on that runner/machine. Please try building on a different environment and see if that suceeds.

djsmith85 avatar Sep 25 '22 11:09 djsmith85

Hi, I got around to looking further into this. I confirmed that upgrading to the latest LTS of node.js (16.17.1) did not fix this issue. Different machines wouldn't be the issue since I can recreate the issue both on my local machine and in our CI pipeline.

It looks like for now, as a temporary fix we can use export NODE_OPTIONS="--max-old-space-size=2048" to increase allocated memory. My question is, why did this error just start happening with 2022.9.x?

TinfoilSubmarine avatar Sep 27 '22 12:09 TinfoilSubmarine

We were most likely at the edge of the memory threshold for a while and something in the last release pushed us over the edge. It's not uncommon to have to increase the heap spaces compiling larger webpack projects. 64 bit environments usually have more memory allocated to the heap by default than 32bit.

Since this seems to be resolved I'm going to close the issue.

Hinton avatar Sep 29 '22 10:09 Hinton