ARTIFACTORY: Why am I getting “Failed to start Artifactory service” ERROR: Artifactory Tomcat server did not start in 60 seconds, tomcat will be stopped
In some scenarios, we might see Artifactory failing to initialize due to the tomcat timeout issue. Below is the error you would see when journalctl -xe is executed, in such cases.
artifactory.service start operation timed out. Terminating artifactoryManage.sh[5115]: ** ERROR: Artifactory Tomcat server did not start in 60 seconds, tomcat will be stopped. This timeout can be modified by setting systemd[1]: artifactory.service: control process exited, code=exited status=1 systemd[1]: Failed to start Artifactory service. -- Subject: Unit artifactory.service has failed -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit artifactory.service has failed. -- -- The result is failed. systemd[1]: Unit artifactory.service entered failed state. sclpjfrgapp5004 systemd[1]: artifactory.service failed. sclpjfrgapp5004 sudo[5107]: pam_unix(sudo:session): session closed for user root polkitd[750]: Unregistered Authentication Agent for unix-process:5109:1336500 (system bus name :1.384, object path /org/freedesktop/PolicyKit1/Authentication
Sometimes, Artifactory might take time to initialize due to background tasks such as password encryption, backup [or] due to network latency issues against the disk being used. Since we have a default 60 seconds for tomcat startup timeout, If Artifactory is unable to start within 60 seconds, tomcat will throw the above mentioned error. As a workaround, you may tune the service start timeout in the Artifactory instance, by adding the following snippet to the Artifactory's system.yaml file (/opt/jfrog/artifactory/var/etc/). The configuration value is in seconds.
shared: script: serviceStartTimeout: 600
This will increase the threshold to 10 minutes, which should be more than enough for the Tomcat server to boot up.
NOTE: Restart of the Artifactory is required for the above mentioned configuration addition to take effect.
If you still observe a similar behavior, you may also try increasing the system's default startup timeout setting. By default, it is set to 90 seconds.
# systemctl show artifactory | grep TimeoutStartUSec TimeoutStartUSec=1min 30s
Step-1:Add the TimeoutStartSec in the below file:
# cat /usr/lib/systemd/system/artifactory.service [Unit] Description=Artifactory service After=network.target [Service] Type=forking GuessMainPID=yes Restart=always RestartSec=60 PIDFile=/var/run/artifactory.pid ExecStart=/root/artifactory-pro-7.37.15/app/bin/artifactoryManage.sh start ExecStop=/root/artifactory-pro-7.37.15/app/bin/artifactoryManage.sh stop TimeoutStartSec=240 [Install] WantedBy=multi-user.target Alias=artifactory.service
Step-2:Perform the system reload using the below command.
systemctl daemon-reload
After the reload, you would be able to see the tuned timeout value reflecting from the systemctl output.
systemctl show artifactory | grep TimeoutStartUSec TimeoutStartUSec=4min
Step-3:Restart the Artifactory.
systemctl start artifactory
NOTE: We need to investigate the exact reason for the slowness. The above steps are a workaround to initialize the Artifactory instance while experiencing the Tomcat timeout issues.