KB-2231 Unable to shut down Appian Java components with OOTB stop script
Symptoms
- Zookeeper, Kafka, and/or Tomcat intermittently are not able to be stopped by Appian's out-of-the-box (OOTB)
stop.shscript in<APPIAN_HOME>/services/bin/orstop-appserver.shin<APPIAN_HOME>/tomcat/apache-tomcat/bin/. - The process IDs (PIDs) of Zookeeper, Kafka, and/or Tomcat are not shown in the output of
jpscommand, but able to be identified in the output ofps -ef | grep javacommand. /tmp/hsperfdata_<current_user>does not contain the PIDs of Zookeeper, Kafka, and/or Tomcat.
Cause
The stop.sh and stop-appserver.sh script searches for Zookeeper, Kafka, and Tomcat in Java processes, which are referred to in the jps command. jps searches /tmp/hsperfdata_<current_user>, where it expects Java processes to have created a directory with metadata.
When the /tmp/hsperfdata_<current_user> has a file for each of the Appian Java process' PID, the corresponding process will show up in the jps command output and the OOTB stop scripts should work.
When the /tmp/hsperfdata_<current_user> does not contain a file for each of the Appian Java process' PID, the corresponding process will not show up in the output of jps command, resulting in the failure of the OOTB stop scripts to stop Appian Java components.
Action
- Confirm if the stop script is running as a different user than the Appian Java process, as the directory that the jps command searches in is dependent on the current user. If the user is different, make sure the stop script is ran by the same user as the Appian Java process in question.
- If the stop script is ran by the exact same user as the running Java processes and the issue only happens after Appian runs for more than a certain period of time, confirm with your server team to see if there is any cronjob/mechanism that is cleaning up the
/tmp/hsperfdata_<current_user>folder or the entire/tmpdirectory.
Workaround
Bring down Tomcat
If Tomcat cannot be stopped with the OOTB stop-appserver script, follow the below steps to bring down tomcat:
- Run
ps -ef | grep tomcatto identify the PID for Tomcat. - Manually terminate Tomcat by using
kill -9 <Tomcat_PID>
Bring down Kafka and Zookeeper
If Kafka and Zookeeper cannot be stopped with the OOTB stop script, follow the below steps to bring down Kafka and Zookeeper:
- Make sure app server(s), search server(s), data server(s), and engines have all been stopped.
- Run
ps -ef | grep kafkaandps -ef | grep zookeeperon all nodes hosting Kafka and Zookeeper to identify the PIDs respectively. - Manually terminate Kafka on all nodes hosting Kafka using the following command:
kill -9 <Kafka_PID> - Next, manually terminate Zookeeper on all nodes hosting Zookeeper using the following command:
kill -9 <Zookeeper_PID> - Confirm all Appian components are down on all nodes.
- Start up Internal Messaging Services using
<APPIAN_HOME>/services/bin/start.sh -p <password> -s manageron all nodes hosting Kafka and Zookeeper. This should start up Service Manager, Kafka, and Zookeeper. This should also generate the expected data in/tmp/hsperfdata_<current_user>and as a result thejpscommand should return PIDs for Service Manager, Kafka and Zookeeper. - Confirm that Zookeeper cluster and Kafka cluster are up and running using status script.
- Stop all the components gracefully depending on the installation type listed below
- Standalone: run
<APPIAN_HOME>/services/bin/stop.sh -p <password> -s allon the node hosting Zookeeper and Kafka. - HA: run
<APPIAN_HOME>/services/bin/stop.sh -p <password>on all nodes hosting Zookeeper and Kafka.
- Standalone: run
Affected Versions
This article applies to all self-managed versions of Appian on Linux.
Last Reviewed: January 2023
