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

Rust build possibly running out of RAM #77

Closed
Benji377 opened this issue May 12, 2023 · 8 comments · Fixed by Raspirus/raspirus#182
Closed

Rust build possibly running out of RAM #77

Benji377 opened this issue May 12, 2023 · 8 comments · Fixed by Raspirus/raspirus#182

Comments

@Benji377
Copy link

Intro

I am creating a Tauri app. It has a frontend in Next.js and the backend in Rust. Using the Tauri command with cargo, I can build the project for different platforms like Ubuntu, Windows and Mac. Unfortunately, I am not able to compile the project for the Raspberry Pi because it has a different chip architecture. Therefore, I wanted to use your runner to try and build it using GitHub actions.

Problem

When I execute the GitHub action, everything seems to work fine, up until it tries to install tauri with the cargo command: cargo install tauri-cli. Then it starts compiling the needed dependencies and eventually fails because it doesn't have enough RAM to continue. It doesn't say that it doesn't have enough RAM, but when I tried to install tauri on my Raspberry Pi 3B+ with 1 GB of RAM, I encountered the same error. I solved it by increasing swap to 4 GB.

GitHub action

name: Raspberry Pi aarch64 cpu
on:
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: pguyot/[email protected]
        with:
          image_additional_mb: 10240
          base_image: https://dietpi.com/downloads/images/DietPi_RPi-ARMv8-Bullseye.7z
          cpu: cortex-a53
          commands: |
            apt-get update -y --allow-releaseinfo-change
            apt-get upgrade -y
            apt-get autoremove -y
            apt-get install curl
            curl https://sh.rustup.rs -sSf | sh -s -- -y
            . "$HOME/.cargo/env"
            curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash
            apt-get install -y nodejs
            npm install next@latest react@latest react-dom@latest eslint-config-next@latest
            apt-get install -y libwebkit2gtk-4.0-dev build-essential wget libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev
            cargo install tauri-cli
            npm install
            cargo tauri build

Action error

2023-05-11T22:24:23.0259502Z Processing triggers for libgdk-pixbuf-2.0-0:arm64 (2.42.2+dfsg-1+deb11u1) ...
2023-05-11T22:24:23.3381137Z + cargo install tauri-cli
2023-05-11T22:24:24.0772696Z     Updating crates.io index
2023-05-11T22:28:52.8116919Z  Downloading crates ...
2023-05-11T22:28:53.3288241Z   Downloaded tauri-cli v1.3.1
2023-05-11T22:28:54.7728017Z   Installing tauri-cli v1.3.1
2023-05-11T22:29:00.9936668Z  Downloading crates ...
2023-05-11T22:29:01.7668171Z   Downloaded aead v0.5.2
2023-05-11T22:29:01.8475646Z   Downloaded adler v1.0.2
...
2023-05-11T22:29:07.9532795Z   Downloaded ring v0.16.20
2023-05-11T22:29:10.0836555Z    Compiling libc v0.2.144
2023-05-11T22:29:10.0896293Z    Compiling proc-macro2 v1.0.56
2023-05-11T22:34:58.0055244Z ##[error]The runner has received a shutdown signal. This can happen when the runner service is stopped, or a manually started runner is canceled.
2023-05-11T22:34:58.0217639Z ##[error]Process completed with exit code 143.
@Benji377
Copy link
Author

Well, never mind, I just run the free -m command in the Runner, and it does have about 7 GB of RAM. That's more than the Raspberry I used with SWAP.

               total        used        free      shared  buff/cache   available
Mem:            6943         617         205          22        6121        6010
Swap:           4095           0        4095

I really don't know what the issue could be now

@razr
Copy link
Contributor

razr commented May 19, 2023

@Benji377 It might be due to the disk space. By default, it is about 24GB available, see #75

@Benji377
Copy link
Author

I executed df -h just before the runner exits to check the size and here is the output:

 + df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop3p2     11G  4.1G  6.0G  41% /
/dev/loop3p1    127M   32M   96M  26% /boot
devtmpfs        3.4G     0  3.4G   0% /dev
+ cargo install tauri-cli

After I execute the cargo install tauri-cli command, the Runner exits.
@razr Maybe it has to do with disk space, but how do I increase it?

@razr
Copy link
Contributor

razr commented May 19, 2023

I'm doing it like this for the GH runner:

    - name: Increase free space
      # Remove Android and dotnet
      run: |
        df -h
        sudo rm -rf /usr/local/lib/android
        sudo rm -rf /usr/share/dotnet
        df -h

I see that you set image_additional_mb: 10240. Maybe it should be more?

@Benji377
Copy link
Author

Unfortunately, even when doubling the size, I get the same error

@pguyot
Copy link
Owner

pguyot commented May 21, 2023

This seems to be related:
rust-lang/rust#64248 (comment)

But the workaround (cleaning up registry), didn't work unfortunately.
https://github.com/pguyot/Raspirus/actions/runs/5039405198/jobs/9037523222#step:3:765

@Benji377
Copy link
Author

What you are saying is that this issue is more likely related to Rust not being able to download some crates, right?

@pguyot
Copy link
Owner

pguyot commented May 21, 2023

The issue is Rust related. It's not that it cannot download crates but rather that it cannot download the index.
I did find a workaround and created a PR on your repo. It's still running but past the installation of taurus-cli.

See https://github.com/pguyot/Raspirus/actions/runs/5039610464/jobs/9037866452

Source for the workaround: libp2p/rust-libp2p#3782 (comment)

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

Successfully merging a pull request may close this issue.

3 participants