newsnowlabs / dockside

Develop, stage and test on-prem or in your private cloud. Dockside is a tool for provisioning lightweight access-controlled IDEs, staging environments and sandboxes - aka 'devtainers' - on local machine, on-premises raw metal or VM, or in the cloud
https://dockside.io/
Apache License 2.0
255 stars 17 forks source link

Theia devel 1.40 update #13

Closed MarkFitzpatrickNN closed 1 year ago

MarkFitzpatrickNN commented 1 year ago

Update theia from version 1.35.0 to version 1.40.0.

struanb commented 1 year ago

Thanks @MarkFitzpatrickNN, looking at this now.

struanb commented 1 year ago

Your branch has a seemingly empty merge commit that I prefer to keep out of main, and the comment on the main commit (https://github.com/newsnowlabs/dockside/pull/13/commits/ec97b3e892a570a46ed9f239a673defae35e10e5) should read Upgrade Theia to v1.40.0 including yarn.lock for consistent build (for clarity and consistency).

I've therefore cherry-picked https://github.com/newsnowlabs/dockside/pull/13/commits/ec97b3e892a570a46ed9f239a673defae35e10e5 into the main branch (we operate a rebase merge strategy on Dockside's main branch anyway) and amended the commit message accordingly.

Next I've tested build for other supported architectures as per https://github.com/newsnowlabs/dockside/blob/main/docs/developing/building-production-image.md with the following results:

Thearm/v7 failure arises from building Theia 1.40.0, as I checked building the latest release which builds 1.35.0 and that still builds fine. Error is:

#0 78.48 $ theia build --mode production
#0 79.14 Failed to resolve module: @theia/electron
#0 112.4 
#0 112.4 <--- Last few GCs --->
#0 112.4 
#0 112.4 [7819:0x93cb9800]     4063 ms: Scavenge 1.7 (3.2) -> 1.7 (4.5) MB, 0.5 / 0.0 ms  (average mu = 1.000, current mu = 1.000) allocation failure 
#0 112.4 [7819:0x93cb9800]     4066 ms: Mark-sweep (reduce) 1.7 (3.5) -> 1.2 (4.5) MB, 2.8 / 0.0 ms  (average mu = 1.000, current mu = 1.000) last resort GC in old space requested
#0 112.4 [7819:0x93cb9800]     4071 ms: Mark-sweep (reduce) 1.2 (3.5) -> 1.2 (4.0) MB, 5.6 / 0.0 ms  (average mu = 0.002, current mu = 0.002) last resort GC in old space requested
#0 112.4 
#0 112.4 
#0 112.4 <--- JS stacktrace --->
#0 112.4 
#0 112.4 FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
#0 112.4 
#0 112.7 Error: webpack exited with an unexpected signal: SIGABRT.
#0 112.7     at ChildProcess.<anonymous> (/opt/dockside/ide/theia/theia-1.40.0/theia/node_modules/@theia/application-manager/lib/application-process.js:59:28)
#0 112.7     at ChildProcess.emit (events.js:400:28)
#0 112.7     at maybeClose (internal/child_process.js:1088:16)
#0 112.7     at Process.ChildProcess._handle.onexit (internal/child_process.js:296:5)
#0 112.7 error Command failed with exit code 1.
#0 112.7 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
#0 112.7 error Command failed with exit code 1.
#0 112.7 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
struanb commented 1 year ago

I've tried numerous modifications to the Theia build command line - increasing --max_old_space_size from 4096 to 8192 and even 16384; other memory-management options like --optimize_for_size, --gc_global, and --compact_gc - all to no avail.

I've tried these options on Depot's arm hardware with 32GB RAM, so it is hard to see why memory shortage should be an issue.

I've reluctantly concluded that Theia 1.40.0 is incompatible with the linux/arm/v7 platform.

This presented a conundrum:

  1. Keep all platforms using Theia 1.35.0 until the issue is resolved upstream, holding up Theia upgrades for other Dockside platforms?
  2. Drop support for linux/arm/v7, required to run on rPI 32bit Raspbian?
  3. Modify the build process to support different Theia versions for different platforms?

(1) is not an option. I am reluctant to accept (2) right now, as while there is now a 64bit version of Raspbian able to run on rPi 4, it is still relatively new and seems a shame to drop support when Dockside still works.

And it is not inconceivable that this issue will arise again, with a new version of Theia working on some supported platforms but not yet on others.

I have therefore opted to modify the build process to support different Theia versions for different platforms. Docker does not support setting build variables to different values for different platforms. This therefore entailed moving the Theia version specification from build.sh into Dockerfile, and a variety of other changes to Dockerfile to facilitate the required env vars to be set to the intended value for each platform.

I am pushing the changes from your branch to a new branch https://github.com/newsnowlabs/dockside/tree/theia-devel-1.40-mixed. (Please note the yarn.lock for Theia must be in the Theia version build directory not the Dockside build directory: I've moved it to the right place in this branch).

struanb commented 1 year ago

I am closing this PR having created a new one (https://github.com/newsnowlabs/dockside/pull/14) from the new branch. Please review the changes and comment there.

MarkFitzpatrickNN commented 1 year ago

Thanks Struan, I've made some notes on these smaller things that caught me out for future reference.

struanb commented 1 year ago

Completed by https://github.com/newsnowlabs/dockside/releases/tag/v2.4.0