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

Memory Leak #109

Open
wbelhomsi opened this issue May 28, 2024 · 1 comment
Open

Memory Leak #109

wbelhomsi opened this issue May 28, 2024 · 1 comment

Comments

@wbelhomsi
Copy link

Hi, I have noticed a severe memory leak, and was wondering if I have anything in my config that might cause this? I followed the README with some edits.
8:30 AM:
MemoryLeak1
11:30 AM:
MemoryLeak2

A docker inspect (it shows stuff that I did not change but its a good inspect for everything)

docker run \
  --name "/ton-http-api-main-1" \
  --runtime "runc" \
  --mount type=bind,source=/home/XXX/ton-http-api/private/mainnet.json,destination=/run/secrets/liteserver_config,readonly \
  --log-driver "json-file" \
  --restart "unless-stopped" \
  --publish "0.0.0.0:8081:8081/tcp" \
  --network "ton-http-api_internal" \
  --network-alias "main" \
  --hostname "c7fdd3910d7e" \
  --expose "8081/tcp" \
  --env "TON_API_JSON_RPC_ENABLED=1" \
  --env "TON_API_CACHE_ENABLED=0" \
  --env "TON_API_CACHE_REDIS_PORT=6379" \
  --env "TON_API_GET_METHODS_ENABLED=1" \
  --env "TON_API_ROOT_PATH=/" \
  --env "TON_API_CACHE_REDIS_ENDPOINT=cache_redis" \
  --env "TON_API_TONLIB_CDLL_PATH=" \
  --env "TON_API_TONLIB_LITESERVER_CONFIG=/run/secrets/liteserver_config" \
  --env "TON_API_TONLIB_REQUEST_TIMEOUT=20" \
  --env "TON_API_CACHE_REDIS_TIMEOUT=1" \
  --env "TON_API_TONLIB_KEYSTORE=/tmp/ton_keystore/" \
  --env "TON_API_TONLIB_PARALLEL_REQUESTS_PER_LITESERVER=500000" \
  --env "TON_API_LOGS_JSONIFY=0" \
  --env "TON_API_LOGS_LEVEL=ERROR" \
  --env "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \
  --label "com.docker.compose.config-hash"="49a216c0adea5abd303878833e132abd4418bd99f73942bb117b615db88d7a27" \
  --label "com.docker.compose.container-number"="1" \
  --label "com.docker.compose.depends_on"="" \
  --label "com.docker.compose.image"="sha256:f827c92d6946daeaf096d137385bcbd090b8946b9a95b40bc8cf474a84c4311a" \
  --label "com.docker.compose.oneoff"="False" \
  --label "com.docker.compose.project"="ton-http-api" \
  --label "com.docker.compose.project.config_files"="/home/XXX/ton-http-api/docker-compose.yaml" \
  --label "com.docker.compose.project.working_dir"="/home/XXX/ton-http-api" \
  --label "com.docker.compose.service"="main" \
  --label "com.docker.compose.version"="2.6.0" \
  --label "org.opencontainers.image.ref.name"="ubuntu" \
  --label "org.opencontainers.image.version"="20.04" \
  --attach stdout \
  --attach stderr \
  --entrypoint "/bin/bash" \
  "toncenter/ton-http-api" \
  "-c" "gunicorn -k uvicorn.workers.UvicornWorker -w 12 --bind 0.0.0.0:8081  pyTON.main:app"
@kdimentionaltree
Copy link
Collaborator

Hello, unfortunately the memory leak is somewhere in c++ tonlib code. Currently you can add the following parameter to avoid significant memory leak.
TON_API_GUNICORN_FLAGS="--keep-alive 127 --max-requests 256000 --max-requests-jitter 32000"
This parameter will instruct workers to restart every 256000 + randint(1, 32000) requests.

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

2 participants