systemd halts restart-domain payara

567 views
Skip to first unread message

koen van der rijt

unread,
Jul 4, 2017, 5:46:55 AM7/4/17
to Payara Forum
I've got a annoying problem at the moment with payara and systemd on centos7.

when I first start payara via systemd and later when I (or jenkins) use asadmin to restart-domain. It will stop payara and not start it again. systemd thinks the payara service is failing and it enters a failed state and never starts the domain.

The contents of my payara.service file:

# cat /etc/systemd/system/payara.service 
[Unit]¬                            
Description=Payara (Glassfish) Server¬
After=syslog.target network.target¬
¬
[Service]¬
Type=forking¬
User=payara¬
RestartSec=10¬
ExecStart=/opt/payara/bin/asadmin start-domain¬
ExecStop=/opt/payara/bin/asadmin stop-domain¬


Journalctl after I use ./asadmin restart-domain 
# journalctl --unit payara 
Jul 04 08:36:35 payara.dev systemd[1]: Starting Payara (Glassfish) Server...
Jul 04 08:36:41 payara.dev asadmin[4101]: Waiting for domain1 to start .....
Jul 04 08:36:41 payara.dev asadmin[4101]: Successfully started the domain : domain1
Jul 04 08:36:41 payara.dev asadmin[4101]: domain  Location: /opt/payara41/glassfish/domains/domain1
Jul 04 08:36:41 payara.dev asadmin[4101]: Log File: /opt/payara41/glassfish/domains/domain1/logs/server.log
Jul 04 08:36:41 payara.dev asadmin[4101]: Admin Port: 4848
Jul 04 08:36:41 payara.dev asadmin[4101]: Command start-domain executed successfully.
Jul 04 08:36:42 payara.dev systemd[1]: Started Payara (Glassfish) Server.
Jul 04 08:41:28 payara.dev systemd[1]: payara.service: main process exited, code=exited, status=10/n/a
Jul 04 08:41:29 payara.dev asadmin[4253]: CLI306: Warning - The server located at /opt/payara41/glassfish/domains/domain1 is not running.
Jul 04 08:41:29 payara.dev asadmin[4253]: Command stop-domain executed successfully.
 
When I circumvent systemd with starting the domain with ./asadmin start-domain it will restart-domain just fine. So I think systemd doesn't like fact that ./asadmin is interfering with a service that is his/hers to manage and stops the attempt. Im a bit stuck at the moment, probably I just can't find the right words to search this.

any hints will be greatly appreciated. 
thanks in advance 

Koen
 

Ondrej Mihályi

unread,
Jul 4, 2017, 7:46:31 AM7/4/17
to koen van der rijt, Payara Forum
Hi,

It seems that serverd detects that the process isn't running and runs the ExecStop command, which attempts to stop the domain, but the domain isn't running (yet) so it shouldn't do any harm. However, I don't understand why restart-domain fails to start the domain again.

Try using the PIDFile= option in the serviced configuration. It is recommended when Type=forking. Payara Server creates a PID file in the domain config directory:

[Service]¬
Type=forking¬
PIDFile=/opt/payara/glassfish/domains/domain1/config/pid¬

Ondro

--
You received this message because you are subscribed to the Google Groups "Payara Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to payara-forum+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/payara-forum/b149c909-d719-42e6-8b5b-2fa0ac784560%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

koen van der rijt

unread,
Jul 4, 2017, 9:37:15 AM7/4/17
to Payara Forum, kvand...@gmail.com
I added the pid file to my payara.service but it didn't resolve the issue.

thanks for the suggestion tho

Op dinsdag 4 juli 2017 13:46:31 UTC+2 schreef Ondro Mihályi:
To unsubscribe from this group and stop receiving emails from it, send an email to payara-forum...@googlegroups.com.

Ondrej Mihályi

unread,
Jul 4, 2017, 12:35:41 PM7/4/17
to koen van der rijt, Payara Forum
I guess that systemd isn't able to pick up the new process after the old one is stopped and new is started, because it has a different PID.

You may get better results with running Payara Server in watchdog mode - the asadmin process will hang and wait until the server is stopped. If domain is restarted, asadmin process will remain the same. SystemD will have to check the asadmiin process instead of the server's process. It would also mean that 2 JVM processes will be running (asadmin and server).

Try with the following SystemD config:

[Service]¬
Type=simple¬
User=payara¬
RestartSec=10¬
ExecStart=/opt/payara/bin/asadmin start-domain --watchdog¬
ExecStop=/opt/payara/bin/asadmin stop-domain¬



To unsubscribe from this group and stop receiving emails from it, send an email to payara-forum+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/payara-forum/acded38c-7892-4d37-afa6-1cc2af35bc24%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages