You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add workaround for race condition in start-stop-daemon
There’s a race condition in start-stop-daemon when --make-pidfile and
--background are used together [1]. This race condition can lead to the
command returning before the PID file has been created. The missing PID
file then causes the launch script to incorrectly report that the
service failed to start.
This commit updates the launch script to wait for up to 10 seconds for
the PID file to be created when start-stop-daemon is used to launch the
app.
Closesgh-4524
[1] https://bugs.launchpad.net/ubuntu/+source/dpkg/+bug/1036899
Copy file name to clipboardExpand all lines: spring-boot-tools/spring-boot-loader-tools/src/main/resources/org/springframework/boot/loader/tools/launch.script
+15Lines changed: 15 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -80,6 +80,20 @@ isRunning() {
80
80
ps -p $1&> /dev/null
81
81
}
82
82
83
+
await_file() {
84
+
end=`date +%s`
85
+
let"end+=10"
86
+
while [ !-f$1 ]
87
+
do
88
+
now=`date +%s`
89
+
echo$now
90
+
if [[ $now-ge$end ]];then
91
+
break
92
+
fi
93
+
sleep 1
94
+
done
95
+
}
96
+
83
97
# Determine the script mode
84
98
action="run"
85
99
if [[ "$MODE"=="auto"&&-n"$init_script" ]] || [[ "$MODE"=="service" ]];then
0 commit comments