neolink icon indicating copy to clipboard operation
neolink copied to clipboard

<jemalloc>: Unsupported system page size - docker on Debian 12 on rpi5

Open schredder opened this issue 1 year ago • 10 comments

Describe the bug jemalloc doesn't like Debian 12's default page size on the raspberry pi 5. This is my first time using neolink, so I don't know if it's specifically related to tikv-jemalloc.

To Reproduce

  1. Create a config.toml
  2. Use the steps from neolink's README
 % uname -a
Linux piebridge 6.6.28+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.28-1+rpt1 (2024-04-22) aarch64 GNU/Linux
 % sudo docker run --network host --volume=$PWD/config.toml:/etc/neolink.toml quantumentangledandy/neolink
Running: /bin/sh -c /usr/local/bin/neolink "${NEO_LINK_MODE}" --config /etc/neolink.toml
<jemalloc>: Unsupported system page size
<jemalloc>: Unsupported system page size
memory allocation of 5 bytes failed
Aborted (core dumped)

Expected behavior The application to launch without core dumping

Versions NVR software: N/A Neolink software: 0.6.2 Reolink camera model and firmware: N/A

schredder avatar May 21 '24 19:05 schredder

Confirmed I can pull and start the v0.6.1 docker image.

schredder avatar May 21 '24 20:05 schredder

heh, I've learned a lot about this issue. https://github.com/jemalloc/jemalloc/issues/467

Some folks are setting page size conditionally for linux/arm64: https://github.com/PingCAP-QE/ci/pull/2409/files

schredder avatar May 22 '24 23:05 schredder

I don't compile or do much direct work with jemalloc. Instead I use this crate https://github.com/tikv/jemallocator which implements an allocator. This should probably be addressed there not here.

From your linked issue it seems that if the code is compiled on device it would work. The other option would be to disable it on certain builds. But we had memory fragmentation issues without it.

QuantumEntangledAndy avatar Jun 01 '24 03:06 QuantumEntangledAndy

This also affects my Apple Silicon machine running Debian 12 with a 16 KB page size.

It seems like bumping to 16 KB on ARM64 via JEMALLOC_SYS_WITH_LG_PAGE=14 should be fine for machines with a 4 KB page size too. In addition to https://github.com/PingCAP-QE/ci/pull/2409 linked above, https://github.com/tikv/jemallocator/issues/80 also recommends this.

jasoncodes avatar Jun 06 '24 01:06 jasoncodes

I've compiled this for a RPi 5 and built a docker image myself: https://hub.docker.com/repository/docker/sehgalanuj/neolink/

The latest tag I pushed to my repository is working, at least for me.

sehgalanuj avatar Jun 09 '24 03:06 sehgalanuj

@sehgalanuj How does memory consumption compare to <=0.6.1?

schredder avatar Jun 10 '24 17:06 schredder

@sehgalanuj How does memory consumption compare to <=0.6.1?

This is really the first time I'm using neolink so I'm not sure how well the memory consumption would really compare. So far, on a RPi 5 it is not having any issues though, and I use this RPi 5 for a lot of things on it.

sehgalanuj avatar Jun 10 '24 21:06 sehgalanuj

For context, v0.6.1 will use a few dozen MBs at launch, and grow to 2GB in about 12 hours.

schredder avatar Jun 10 '24 22:06 schredder

For context, v0.6.1 will use a few dozen MBs at launch, and grow to 2GB in about 12 hours.

This seems quite comparable. Sits at just about 2GB at the moment, and has been running for a couple of days now.

sehgalanuj avatar Jun 10 '24 22:06 sehgalanuj

I'm still keeping my eye on this, but it's been a busy summer. After using the RC with jemalloc for a bit, it was crashing consistently after some period of time. So I'm back to v0.6.1, which works, and I'm living with the OOMkill/restart and recovers every 12-24 hours. Once my schedule calms down, I'll dig into what's going on.

schredder avatar Jul 19 '24 17:07 schredder