Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion build/docker/start_kmesh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pid=$!

# pass SIGTERM to kmesh process
function stop_kmesh() {
echo "received SIGTERM, stopping kmesh"
kill $pid
}

Expand All @@ -43,8 +44,14 @@ function cleanup(){
umount -t cgroup2 /mnt/kmesh_cgroup2/
rm -rf /mnt/kmesh_cgroup2
rm -rf /sys/fs/bpf/bpf_kmesh
echo "kmesh exit"
}

trap 'stop_kmesh' SIGTERM
wait # wait child process exit

# wait for kmesh process to exit, cannot use wait $pid here, because the script received SIGTERM, wait will return immediately
while kill -0 $pid 2>/dev/null; do
sleep 1
done

cleanup
2 changes: 1 addition & 1 deletion pkg/status/status_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ func (s *Server) setBpfLogLevel(w http.ResponseWriter, levelStr string) {
func (s *Server) StartServer() {
go func() {
err := s.server.ListenAndServe()
if err != nil {
if err != nil && err != http.ErrServerClosed {
log.Errorf("Failed to start status server: %v", err)
}
}()
Expand Down