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

Problem with jemalloc on system with larger page size #6742

Closed
1 task done
jtraglia opened this issue Feb 22, 2024 · 4 comments · Fixed by #6766 or #7123
Closed
1 task done

Problem with jemalloc on system with larger page size #6742

jtraglia opened this issue Feb 22, 2024 · 4 comments · Fixed by #6766 or #7123
Labels
C-bug An unexpected or incorrect behavior

Comments

@jtraglia
Copy link
Contributor

Describe the bug

It appears that jemalloc is built with the expectation of 4K pages. This will not work for Linux systems with larger page sizes, such as 16K and 64K on some newer ARM systems. I mentioned this in telegram and the following PR was made:

But this doesn't appear to disable jemalloc. If I test this on a different ARM system with a standard 4K page size, it shows that jemalloc is still enabled:

$ getconf PAGE_SIZE
4096
$ docker run --rm ghcr.io/paradigmxyz/reth:v0.1.0-alpha.19 --version
reth Version: 0.1.0-alpha.19
Commit SHA: 0192934
Build Timestamp: 2024-02-19T21:13:25.581883626Z
Build Features: jemalloc
Build Profile: maxperf

Worth mentioning that this isn't an issue on macOS for some reason. It must use a jemalloc built to support 16K pages.

Steps to reproduce

On an arm64 machine running Linux with a larger page size, run the following command:

$ docker run --rm ghcr.io/paradigmxyz/reth:v0.1.0-alpha.19 --version
<jemalloc>: Unsupported system page size
<jemalloc>: Unsupported system page size
memory allocation of 5 bytes failed

You can check the page size like so:

$ getconf PAGE_SIZE
16384

Node logs

No response

Platform(s)

Linux (ARM)

What version/commit are you on?

v0.1.0-alpha.19

What database version are you on?

N/A

What type of node are you running?

Archive (default)

What prune config do you use, if any?

No response

If you've built Reth from source, provide the full command you used

No response

Code of Conduct

  • I agree to follow the Code of Conduct
@jtraglia jtraglia added C-bug An unexpected or incorrect behavior S-needs-triage This issue needs to be labelled labels Feb 22, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in Reth Tracker Feb 24, 2024
@jtraglia
Copy link
Contributor Author

jtraglia commented Mar 1, 2024

@DaniPopes the PR I made last week did not fix this problem. It appears that jemalloc is still enabled on aarch64 docker images. How are the Reth docker images created? And can you re-open this issue?

$ docker run --rm ghcr.io/paradigmxyz/reth:v0.1.0-alpha.20 --version
<jemalloc>: Unsupported system page size
<jemalloc>: Unsupported system page size
memory allocation of 5 bytes failed

$ docker run --rm ghcr.io/paradigmxyz/reth:v0.1.0-alpha.21 --version
<jemalloc>: Unsupported system page size
<jemalloc>: Unsupported system page size
memory allocation of 5 bytes failed

@DaniPopes DaniPopes reopened this Mar 1, 2024
@github-project-automation github-project-automation bot moved this from Done to In Progress in Reth Tracker Mar 1, 2024
@DaniPopes
Copy link
Member

Docker releases are created with

run: make PROFILE=maxperf docker-build-latest

We want to remove jemalloc from FEATURES when building for docker in the makefile.

@jtraglia
Copy link
Contributor Author

jtraglia commented Mar 1, 2024

Hmm. But I thought that's what my PR did.

docker-build-latest calls build_docker_image

reth/Makefile

Lines 187 to 188 in 02111c4

docker-build-latest: ## Build and push a cross-arch Docker image tagged with the latest git tag and `latest`.
$(call build_docker_image,$(GIT_TAG),latest)

build_docker_image will build the aarch64 binary.

reth/Makefile

Lines 199 to 208 in 02111c4

define build_docker_image
$(MAKE) build-x86_64-unknown-linux-gnu
mkdir -p $(BIN_DIR)/amd64
cp $(BUILD_PATH)/x86_64-unknown-linux-gnu/$(PROFILE)/reth $(BIN_DIR)/amd64/reth
$(MAKE) build-aarch64-unknown-linux-gnu
mkdir -p $(BIN_DIR)/arm64
cp $(BUILD_PATH)/aarch64-unknown-linux-gnu/$(PROFILE)/reth $(BIN_DIR)/arm64/reth
docker buildx build --file ./Dockerfile.cross . \

And build-aarch64-unknown-linux-gnu filters out jemalloc.

reth/Makefile

Lines 88 to 91 in 02111c4

# Disable asm-keccak optimizations and jemalloc.
# Some aarch64 systems use larger page sizes and jemalloc doesn't play well.
# See: https://github.com/paradigmxyz/reth/issues/6742
build-aarch64-unknown-linux-gnu: FEATURES := $(filter-out asm-keccak jemalloc jemalloc-prof,$(FEATURES))

@DaniPopes
Copy link
Member

Ah yeah, it's just enabled by default on every command unless --no-default-features is specified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug An unexpected or incorrect behavior
Projects
Archived in project
2 participants