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

memlock 73728 is the smallest limit that works for Alpine Linux 3.20.3 x86_64 build #211

Closed
alopatindev opened this issue Oct 15, 2024 · 0 comments

Comments

@alopatindev
Copy link
Contributor

alopatindev commented Oct 15, 2024

It took... an embarrassingly long time for me to figure out what was not right. It'd be nice to update readme so it won't confuse anyone anymore.

Most of the time I was sure that the limit simply was not applied to the process which appeared to be false.

Alpine is an unusual distro: for instance it mostly doesn't use PAM, so /etc/security/limits.conf is mostly ignored.

Here's how to reproduce the issue:

#!/usr/bin/env sh

set -xeuo pipefail

#TARGET_CPU="native"
TARGET_CPU="nocona"

apk add --update --no-cache cargo clang17-libclang cmake findutils g++ git linux-headers liburing make rust

DISABLE_AVX512=$(rustc --print target-features | grep '    avx512' | grep -v 'avx512fp16' | awk '{print $1}'  | sed 's/^/-C target-feature=-/' | xargs)
export RUSTFLAGS="-C target-cpu=${TARGET_CPU} ${DISABLE_AVX512}"
export CFLAGS="-D_GNU_SOURCE -march=${TARGET_CPU}"
export PATH="${HOME}/.cargo/bin:${PATH}"

cargo install --force --locked bindgen-cli --version 0.70.1
cargo install --force --locked aquatic_ws --version 0.9.0
mv ~/.cargo/bin/aquatic_ws /usr/local/bin

mkdir -p /etc/init.d
echo "#!/sbin/openrc-run

rc_ulimit='-l 65536' # this will OOM, however it's suggested by the readme
#rc_ulimit='-l 73728' # this works

name='aquatic_ws'
command='/usr/local/bin/aquatic_ws'
command_args='--config-file /etc/aquatic_ws.conf'
command_user='nobody:nogroup'
pidfile='/run/aquatic_ws.pid'
command_background=true
output_logger='logger'
error_logger='logger'

depend() {
	need net
	use logger
}
" > /etc/init.d/aquatic_ws

echo 'socket_workers = 1
swarm_workers = 1
log_level = "info"

[network]
address = "[::ffff:127.0.0.1]:3000"
only_ipv6 = false
tcp_backlog = 1024
enable_tls = false
tls_certificate_path = ""
tls_private_key_path = ""
websocket_max_message_size = 65536
websocket_max_frame_size = 16384
websocket_write_buffer_size = 8192
enable_http_health_checks = false

[protocol]
max_scrape_torrents = 255
max_offers = 10
peer_announce_interval = 120

[cleaning]
torrent_cleaning_interval = 30
max_peer_age = 180
max_offer_age = 120
connection_cleaning_interval = 30
max_connection_idle = 180
close_after_tls_update_grace_period = 216000

[privileges]
drop_privileges = false

[access_list]
mode = "off"
path = "./access-list.txt"

[metrics]
run_prometheus_endpoint = false
prometheus_endpoint_address = "127.0.0.1:9000"
torrent_count_update_interval = 10
peer_clients = false
peer_id_prefixes = false
' > /etc/aquatic_ws.conf

chmod +x /etc/init.d/aquatic_ws
/etc/init.d/aquatic_ws start

tail -n 100 -F /var/log/messages
@alopatindev alopatindev changed the title memlock 73728 is the smallest limit that works for Alpine Linux 3.20.3 build memlock 73728 is the smallest limit that works for Alpine Linux 3.20.3 x86_64 build Oct 15, 2024
alopatindev added a commit to alopatindev/aquatic that referenced this issue Oct 15, 2024
…s for Alpine Linux 3.20.3 x86_64 build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant