QuantumEntangledAndy / neolink

An RTSP bridge to Reolink IP cameras
GNU Affero General Public License v3.0
330 stars 45 forks source link

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

Open schredder opened 4 months ago

schredder commented 4 months ago

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 commented 4 months ago

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

schredder commented 4 months ago

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

QuantumEntangledAndy commented 4 months ago

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.

jasoncodes commented 3 months ago

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.

sehgalanuj commented 3 months ago

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.

schredder commented 3 months ago

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

sehgalanuj commented 3 months ago

@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.

schredder commented 3 months ago

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

sehgalanuj commented 3 months ago

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.

schredder commented 2 months ago

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.