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

running publish in github actions workflow using windows-latest container: Array buffer allocation failed #2472

Closed
3 tasks done
stepheneb opened this issue Aug 24, 2021 · 5 comments
Labels

Comments

@stepheneb
Copy link

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

6.0.0-beta.59

Electron version

v13.1.8

Operating system

Windows Server 2019

Last known working Electron Forge version

No response

Expected behavior

I can run electron-forge publish on my local Windows and MacOS systems successfully.

Running a github actions workflow using their windows-latest container generates a Array buffer allocation failed error during the upload artifact section of the script.

This workflow ran successfully until I added a large directory of source images to the repository. It still runs successfully using the github macos-latest container.

Actual behavior

This is the release workflow:
https://github.com/stepheneb/cfa-own-electron/blob/main/.github/workflows/release.yml

The workflow takes about 10 minutes to complete in the macos container and errors while uploading artifact: Uploading Artifacts 0/1 to v1.0.0-beta.6 in the windows container after about 16 minutes.

The latest error log from the github windows_latest container:
https://github.com/stepheneb/cfa-own-electron/runs/3414592521?check_suite_focus=true#logs

The section displaying the error:

✖ Uploading Artifacts 0/1 to v1.0.0-beta.6

An unhandled error has occurred inside Forge:
Array buffer allocation failed
RangeError: Array buffer allocation failed
    at new ArrayBuffer (<anonymous>)
    at new Uint8Array (<anonymous>)
    at new FastBuffer (internal/buffer.js:956:5)
    at createUnsafeBuffer (buffer.js:152:12)
    at Function.allocUnsafeSlow (buffer.js:394:10)
    at FSReqCallback.readFileAfterStat [as oncomplete] (fs.js:311:31)

Steps to reproduce

Clone and checkout repository. Update the bata version and push tags. This will start the release workflow. The macos release succeeds, the windows release fails.

  1. fork: https://github.com/stepheneb/cfa-own-electron
  2. checkout repo
  3. npm install
  4. npm version prerelease
  5. git push origin main
  6. git push --follow-tags

This is the release workflow:
https://github.com/stepheneb/cfa-own-electron/blob/main/.github/workflows/release.yml

The workflow takes about 10 minutes t o complete in the macos container and errors while uploading artifacts in the windows container after about 16 minutes.

The latest error log from the github windows_latest container:
https://github.com/stepheneb/cfa-own-electron/runs/3414592521?check_suite_focus=true#logs

Unless the issue is obvious I plan to update the workflow running electron-forge publish in the windows container to add additional debugging information in the log.

I suspect the problem uploading the built artifacts on the github windows_latest container started after this commit add source-images and scripts which added this directory of images: https://github.com/stepheneb/cfa-own-electron/tree/main/src/source-images

Additional information

No response

@stepheneb stepheneb added the bug label Aug 24, 2021
@malept
Copy link
Member

malept commented Aug 24, 2021

I suspect this has something to do with the size of the artifacts that you're trying to upload to GitHub Releases. How big are they?

@malept
Copy link
Member

malept commented Aug 24, 2021

Specifically, how big are the Setup.exe and nupkg files?

My guess is that the GitHub hosted Windows runners do not have enough memory to read the files into the heap, in order to construct the payload for uploading the artifact to GitHub Releases. In which case, I don't see a solution that can happen in Electron Forge.

@stepheneb
Copy link
Author

I suspect this has something to do with the size of the artifacts that you're trying to upload to GitHub Releases. How big are they?

The macos container is provisioned with 14GB of ram, the windows containers only 7GB.

CfA.OWN.Electron-1.0.0-beta.6.Setup.exe     218 KB
cfa_owns_electron-1.0.0-beta6-full.nupkg    955 MB

Perhaps disabling the generation of the nupkg artifact would help?

@stepheneb
Copy link
Author

I'm now wondering if running Setup.exe actually downloads the nupkg artifact to complete the installation?

@malept
Copy link
Member

malept commented Aug 25, 2021

I'm now wondering if running Setup.exe actually downloads the nupkg artifact to complete the installation?

Sounds like it's primarily for updates.

The root cause of this issue is that the Windows runner of GItHub Actions does not have enough memory to read a ~1GB file into memory in order to upload it as a release asset. There's not much that Electron Forge can do here since Octokit (the official GitHub API library used) does not have another way to upload release assets, other than passing in a string for data.

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

No branches or pull requests

2 participants