cube icon indicating copy to clipboard operation
cube copied to clipboard

fix(cubestore): build with large pagesize support for arm64

Open vltmn opened this issue 3 months ago • 2 comments

Check List

  • [x] Tests have been run in packages where changes have been made if available
  • [x] Linter has been run for changed code
  • [ ] Tests for the changes have been added if not covered yet
  • [ ] Docs have been added / updated if required

Description of Changes Made (if issue reference is not provided) The ARM docker image of cubestore currently fails when running on a kernel with page size >4k. Example of such environments are Ubuntu server arm64+largemem (64k), MacOS (16k) and Raspberry Pi (16k). An example of the error can be seen in the excerpt below.

$ docker run -it --rm cubejs/cubestore:v1.5.3-arm64v8
<jemalloc>: Unsupported system page size
<jemalloc>: Unsupported system page size
memory allocation of 8 bytes failed

This is a known issue with jemalloc https://github.com/jemalloc/jemalloc/issues/2639 and the default has been changed in the facebook upstream as of https://github.com/facebook/jemalloc/pull/34.

To fix it with cubestore, the cargo build can be run with the JEMALLOC_SYS_WITH_LG_PAGE env set to 2 log of the page size according to the jemalloc-sys crate.

This PR addresses the issue by setting the env variable to 16 (support for up to and including 64k page sizes), and configuring the Github actions to build ARM images with large pagesize support.

I have tested the changes by building the ARM image both with and without the WITH_LG_PAGESIZE build argument set. With the argument set the docker image starts up correctly, without it it shows the same error as before.

If you have ideas of applicable tests to add, I am happy to implement them.

vltmn avatar Nov 19 '25 09:11 vltmn

@vltmn

Thank you for submitting the PR. As you mentioned we are using tikv fork of jemalloc, and I prefer to cherry-pick the original fix that was done in facebook/jemalloc instead of workaround on our side.

So, I've prepared a fix in https://github.com/tikv/jemalloc/pull/6

If they will not be interested to merge that in the "near" time, I will merge your PR as then.

Thanks

ovr avatar Nov 19 '25 11:11 ovr

That makes sense, thank you for considering the changes 👍

vltmn avatar Nov 19 '25 12:11 vltmn