Supervisord and ulimit to java app

2019-05-09 21:51发布

问题:

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

回答1:

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.



回答2:

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.