From 2df0046fa759481f793d9c51563728b21c7858d8 Mon Sep 17 00:00:00 2001 From: Morgan Fainberg Date: Tue, 15 Jul 2014 11:06:36 -0700 Subject: [PATCH] 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 --- lib/apache | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/apache b/lib/apache index c0d32df366..f4f82a1353 100644 --- a/lib/apache +++ b/lib/apache @@ -150,7 +150,12 @@ function stop_apache_server { # restart_apache_server function restart_apache_server { - restart_service $APACHE_NAME + # Apache can be slow to stop, doing an explicit stop, sleep, start helps + # to mitigate issues where apache will claim a port it's listening on is + # still in use and fail to start. + stop_service $APACHE_NAME + sleep 3 + start_service $APACHE_NAME } # Restore xtrace