Confluence does not terminate after shutdown script
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
After stopping confluence via catalina.sh stop
Confluence says, in the logs, that it is stopping, as below:
1
2
INFO [main] [com.atlassian.confluence.lifecycle] contextDestroyed Stopping Confluence
INFO [main] [confluence.cluster.tangosol.TangosolClusterManager] shutdown Shutting down Coherence services
but the java process never terminates.
Resolution
Pass the -force
parameter to catalina.sh
as:
1
catalina.sh stop -force
This will kill the java process and stop Confluence.
If the above results in an error, such as:
1
Kill failed: $CATALINA_PID not set
Please add the following line of code to the top of your <Confluence-Installation-Directory>/bin/setenv.sh
file (Standalone instance):
1
2
CATALINA_PID="<Change this to your preferred location>/id.pid"
export CATALINA_PID
Tomcat will automatically write its process id to id.pid
in your specified path and kill its process with the -force
parameter.
For Linux or Mac user:
In addition to the above, you can try a custom script that runs shutdown.sh
first before forcing Tomcat to shutdown. This script will sleep 60 seconds then look inside ./id.pid
to check if Tomcat is still running. If Tomcat is still running, it will issue a catalina.sh stop -force
.
The script needs to be saved in <confluence install>/bin and assumes id.pid
is located in the same location.
confluenceForceShutdownScript.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh
blah=""
temp=`ps aux|grep confluence|grep -v grep|awk '{print $2}'`
if [ "$temp" == "$blah" ]
then
echo 'Confluence is not running'
exit 0
fi
echo 'Shutting down confluence'
./shutdown.sh
echo 'sleeping 60 seconds'
sleep 60
num=`cat id.pid|awk '{print $1}'`
echo 'Tomcat Process id is: ' "$num"
echo 'Now checking if Confluence is still running...'
if [ "$num" == "$temp" ]
then
echo 'Force killing Tomcat now...'
./catalina.sh stop -force $num
echo 'Killed'
else
echo 'Tomcat is already shutdown'
fi
echo
echo "...done"
ℹ️ Note that this script is provided as is and not supported.
Finding the Root Cause of Shutdown Problems
If you're interesting in tracking down the root cause of the problem, your best option is to:
Attempt to shut down your application server
Take 3-5 thread dumps spaced 1 minute apart.
Look through the thread dumps to see what threads are still active after 5 minutes.
If you need help analyzing the thread dump output, send your updated application server logs to Atlassian Support.
Was this helpful?