Browse code

Make apache restarts a little more forgiving

Apache sometimes is slow to release the port (from the kernel's
perspective) which can cause restarts of apache to fail due to the
requested port already being bound. This fix introduces a small sleep
between the stop and start to help make apache deployments a bit
more resilient.

Change-Id: I9697d71f3cb2d8d5da8fe7ffa8b3e1ade9d52afd
Closes-Bug: #1342256

Morgan Fainberg authored on 2014/07/16 03:06:36
Showing 1 changed files
... ...
@@ -150,7 +150,12 @@ function stop_apache_server {
150 150
 
151 151
 # restart_apache_server
152 152
 function restart_apache_server {
153
-    restart_service $APACHE_NAME
153
+    # Apache can be slow to stop, doing an explicit stop, sleep, start helps
154
+    # to mitigate issues where apache will claim a port it's listening on is
155
+    # still in use and fail to start.
156
+    stop_service $APACHE_NAME
157
+    sleep 3
158
+    start_service $APACHE_NAME
154 159
 }
155 160
 
156 161
 # Restore xtrace