简体   繁体   中英

Supervisord and ulimit to java app

I am using supervisord to start my java app. The application is working OK, but my ulimit nofiles is not set. I could do it in one machine, using debian. but there is a problem on the second machine that this configuration is not working. Basically, I start my app with a script:

#!/bin/sh

iscsiJar="/mnt/cache/jscsi/udrive.jar"

ulimit -SHn 32768

# função para iniciar a aplicação
java -XX:MaxHeapFreeRatio=70 -Xmx2048M -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof -jar $iscsiJar

But my command cat /proc/4171/limits keeps saying:

Max open files 4096 4096 files

Any hint? I already search everywhere at internet.... I could try this way on this question> nohup create new files nohup.out by day

In case someone is still looking for a solution for that, try setting: minfds parameter within supervisord configuration file: http://supervisord.org/configuration.html#supervisord-section-values

Remember to restart the supervisord after configuration change.

I got the solutions writing another java program Test with the supervisor. I also used #!/bin/bash instead of #!/bin/sh and my linux user was not configured properly.

I also used this answer from serverfault to help me.

Supervisor relies at its service config. So to raise limit you need to do it at service level.

This scenario works perfect for ubuntu 20.04

  1. systemctl edit supervisor.service

  2. Enter and save

[Service]
LimitNOFILE=20000
  1. systemctl daemon-reload

  2. systemctl restart supervisor

Then, just to check, cat /proc/ pgrep supervisor /limits | grep open

You will se something like

Max open files            20000                20000                files

It works :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM