Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wildfly as systemd service

I wanna make wildfly-domain as a systemd service in centos7 in works by root user but when i start it as wilfly user after a while it shows error:

java.lang.OutOfMemoryError: unable to create new native threadESC

and stop . even stop service doesn't work .

I tried to change heap-memo and ... but the user is a problem! How can I solve this?

service file is ib wildfly8/bin/init.d/wildfly-init-redhat.sh I tried "ulimit -n " at the top of service script but nothing changed! I have 256Gb Ram and 64core CPU but ....

like image 307
Mehrdad Islamkhah Avatar asked Mar 20 '17 15:03

Mehrdad Islamkhah


1 Answers

Right place for unit is:

/etc/systemd/system/wildfly.service

This minimal is ok

[Unit]
Description=WildFly application server
Wants=network-online.target 
After=network-online.target

[Service]
Type=simple
User=web
Group=web
ExecStart=/opt/wildfly-10.1.0.Final/bin/domain.sh
Restart=always
RestartSec=20

[Install]
WantedBy=multi-user.target

You should edit only ExecStart field to match your path.

Create user web with

useradd web

Also exec by root:

chown -R web:web /opt/wildfly-10.1.0.Final/

When

systemctl start wildfly
systemctl enable wildfly

If you get OOMs, inspect your limits

[Service] section of systemd unit, like

LimitFSIZE=infinity
LimitCPU=infinity
LimitAS=infinity
LimitNOFILE=64000
LimitNPROC=64000

or /etc/security/limits.d/ /etc/security/limits.conf

like image 143
Oleg Gritsak Avatar answered Nov 05 '22 22:11

Oleg Gritsak