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

Building ui container on MacOS leads to segmentation fault #2087

Open
DanielJDufour opened this issue Jan 15, 2025 · 7 comments · Fixed by #2092
Open

Building ui container on MacOS leads to segmentation fault #2087

DanielJDufour opened this issue Jan 15, 2025 · 7 comments · Fixed by #2092
Labels
bug Something isn't working devops Related to deployment or configuration effort:medium Likely a day or two help wanted Extra attention is needed priority:low Backlog of tasks that will be addressed in time

Comments

@DanielJDufour
Copy link
Contributor

Describe the bug
When I run docker compose up on the ui container it fails to build because an issue with corepack enabling pnpm. When I upgraded the base image version to the latest version, it worked.

To Reproduce
Steps to reproduce the behavior:

  1. Set up .env file
  2. export GIT_BRANCH=development
  3. docker compose -f "docker-compose.${GIT_BRANCH}.yml" up --build ui

Expected behavior
I expected no error when trying a clean build

Screenshots
If applicable, add screenshots to help explain your problem.

Image

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6] Macbook
  • OS: [e.g. iOS8.1] MacOS 15.2 Sequoia
  • Browser [e.g. stock browser, safari] N/A
  • Version [e.g. 22] development branch

Additional context
Add any other context about the problem here.
I'll submit a draft PR "fixing" this, but I can't guarantee it won't lead to any regressions as I don't yet have enough experience with the ui to know. I'll create the PR just in case someone can review who knows more of the nuances of the system.

@DanielJDufour DanielJDufour added the bug Something isn't working label Jan 15, 2025
@DanielJDufour
Copy link
Contributor Author

Oof, it gets more complicated. When I upgrade the image from docker.io/node:20-slim to docker.io/node:23-slim, it seems to get passed the previously failing line RUN corepack enable && corepack use [email protected]. However, RUN pnpm run build leads to a 269.1 FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory error.

My hunch is there is either an issue with the specific version of pnpm or there is a memory leak in one of the dependencies.

@DanielJDufour
Copy link
Contributor Author

DanielJDufour commented Jan 15, 2025

When, I bumped up the allocated memory by changing RUN pnpm run build to RUN NODE_OPTIONS="--max-old-space-size=24384" pnpm run build under "manager-frontend" the docker-compose up --build ui ran a lot longer without crashing. It ran for 33 minutes and then I canceled the process as I assume it's not supposed to take that long.

@spwoodcock
Copy link
Member

spwoodcock commented Jan 15, 2025

Thanks @DanielJDufour 👍

Will look into this today.

Just a quick note though: I think the dev setup may be unexpectedly confusing.

The docker-compose.environment.yml files are for the actual deployments, not for local developmemt (the images used during these deploys are built via a buildx github workflow).

That docker-compose.yml file should be used for local development.

Does this error occur for you when building using that file?
docker compose build ui

Note: maybe the deployment compose files should be less prominent, moved to scripts/deploy, plus the docs updated for better clarity

@spwoodcock
Copy link
Member

Agree that bumping pnpm could be a quick fix (or at least worth testing).

There's no reason not to upgrade to the latest version for the frontend and mapper frontend 👍

Note I don't think we should upgrade node to the most recent version, but instead probably to v22 LTS

@spwoodcock
Copy link
Member

Order of testing:

@spwoodcock
Copy link
Member

spwoodcock commented Jan 15, 2025

Further to this, we have additional issues on MacOS:

  • For ODK Central, the file /sys/fs/cgroup/memory/memory.limit_in_bytes does not seem to appear in a MacOS hosted container? This causes the entrypoint to error. Should be fixed in Update start-odk.sh memory calculation to support cgroups v2 getodk/central#876
  • Error starting up the API container due to a failed cryptography import in config.py. Is this because of an issue with the specific dependency on MacOS. This suggests that main.py gets to the point of importing config.py so dependencies must be installed in general. Perhaps its a specific issue with the cryptography package on MacOS?
  • The setup docs are unnecessarily confusing, with multiple docker compose files to choose from. For a user just starting out, it could look like they need the docker-compose.development.yaml (for the dev server), when it's actually the docker-compose.yml needed for local development. This should be clarified.

@spwoodcock spwoodcock changed the title Building ui container leads to segmentation fault Building ui container on MacOS leads to segmentation fault Jan 16, 2025
@spwoodcock spwoodcock added priority:low Backlog of tasks that will be addressed in time devops Related to deployment or configuration effort:medium Likely a day or two help wanted Extra attention is needed labels Jan 16, 2025
@spwoodcock
Copy link
Member

spwoodcock commented Jan 16, 2025

The original error about corepack and segmentation fault during the UI build seems to have been fixed by the pnpm upgrade!

But the remaining 3 tasks above still need to be looked into 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working devops Related to deployment or configuration effort:medium Likely a day or two help wanted Extra attention is needed priority:low Backlog of tasks that will be addressed in time
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants