diff --git a/controller/controller.go b/controller/controller.go index c6a46b3f..e6aaf4d2 100644 --- a/controller/controller.go +++ b/controller/controller.go @@ -18,10 +18,10 @@ package controller import ( "log" - "os/signal" - "syscall" "os" + "os/signal" "runtime/debug" + "syscall" "github.com/fission/fission/crd" ) @@ -33,13 +33,13 @@ func dumpStackTrace() { func Start(port int) { // register signal handler for dumping stack trace. c := make(chan os.Signal, 1) - signal.Notify(c, syscall.SIGTERM) - go func() { + signal.Notify(c, syscall.SIGTERM) + go func() { <-c log.Println("Dumping stack trace") dumpStackTrace() os.Exit(1) - }() + }() fc, _, apiExtClient, err := crd.MakeFissionClient() if err != nil { diff --git a/environments/fetcher/cmd/main.go b/environments/fetcher/cmd/main.go index 72b8347f..f23ae0fe 100644 --- a/environments/fetcher/cmd/main.go +++ b/environments/fetcher/cmd/main.go @@ -10,11 +10,11 @@ import ( "net/http" "net/url" "os" - "strconv" - "time" "os/signal" - "syscall" "runtime/debug" + "strconv" + "syscall" + "time" "github.com/fission/fission" "github.com/fission/fission/environments/fetcher" @@ -28,12 +28,12 @@ func dumpStackTrace() { func main() { // register signal handler for dumping stack trace. c := make(chan os.Signal, 1) - signal.Notify(c, syscall.SIGTERM) - go func() { + signal.Notify(c, syscall.SIGTERM) + go func() { <-c dumpStackTrace() os.Exit(1) - }() + }() flag.Usage = fetcherUsage specializeOnStart := flag.Bool("specialize-on-startup", false, "Flag to activate specialize process at pod starup") diff --git a/executor/executor.go b/executor/executor.go index c836acfe..b3fcf0ec 100644 --- a/executor/executor.go +++ b/executor/executor.go @@ -18,13 +18,13 @@ package executor import ( "log" - "strings" - "sync" - "time" "os" "os/signal" - "syscall" "runtime/debug" + "strings" + "sync" + "syscall" + "time" "github.com/dchest/uniuri" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -194,12 +194,12 @@ func dumpStackTrace() { func StartExecutor(fissionNamespace string, functionNamespace string, port int) error { // register signal handler for dumping stack trace. c := make(chan os.Signal, 1) - signal.Notify(c, syscall.SIGTERM) - go func() { + signal.Notify(c, syscall.SIGTERM) + go func() { <-c dumpStackTrace() os.Exit(1) - }() + }() fissionClient, kubernetesClient, _, err := crd.MakeFissionClient() restClient := fissionClient.GetCrdClient() diff --git a/router/router.go b/router/router.go index f7a33dab..c726c18a 100644 --- a/router/router.go +++ b/router/router.go @@ -45,10 +45,10 @@ import ( "log" "net/http" "os" - "time" "os/signal" - "syscall" "runtime/debug" + "syscall" + "time" "github.com/gorilla/handlers" "github.com/gorilla/mux" @@ -81,12 +81,12 @@ func dumpStackTrace() { func Start(port int, executorUrl string) { // register signal handler for dumping stack trace. c := make(chan os.Signal, 1) - signal.Notify(c, syscall.SIGTERM) - go func() { + signal.Notify(c, syscall.SIGTERM) + go func() { <-c dumpStackTrace() os.Exit(1) - }() + }() fmap := makeFunctionServiceMap(time.Minute) diff --git a/storagesvc/storagesvc.go b/storagesvc/storagesvc.go index aa1ec89a..986082b4 100644 --- a/storagesvc/storagesvc.go +++ b/storagesvc/storagesvc.go @@ -22,11 +22,11 @@ import ( "fmt" "net/http" "os" - "strconv" - "time" "os/signal" - "syscall" "runtime/debug" + "strconv" + "syscall" + "time" "github.com/gorilla/handlers" "github.com/gorilla/mux" @@ -181,12 +181,12 @@ func dumpStackTrace() { func RunStorageService(storageType StorageType, storagePath string, containerName string, port int, enablePruner bool) *StorageService { // register signal handler for dumping stack trace. c := make(chan os.Signal, 1) - signal.Notify(c, syscall.SIGTERM) - go func() { + signal.Notify(c, syscall.SIGTERM) + go func() { <-c dumpStackTrace() os.Exit(1) - }() + }() // initialize logger log.SetLevel(log.InfoLevel) diff --git a/test/test_utils.sh b/test/test_utils.sh index 90afd62c..aa54557e 100755 --- a/test/test_utils.sh +++ b/test/test_utils.sh @@ -59,7 +59,7 @@ build_and_push_fission_bundle() { pushd $ROOT/fission-bundle ./build.sh - docker build -t $image_tag . + docker build -q -t $image_tag . gcloud_login @@ -72,7 +72,7 @@ build_and_push_fetcher() { pushd $ROOT/environments/fetcher/cmd ./build.sh - docker build -t $image_tag . + docker build -q -t $image_tag . gcloud_login @@ -86,7 +86,7 @@ build_and_push_builder() { pushd $ROOT/builder/cmd ./build.sh - docker build -t $image_tag . + docker build -q -t $image_tag . gcloud_login @@ -98,7 +98,7 @@ build_and_push_fluentd(){ image_tag=$1 pushd $ROOT/logger/fluentd - docker build -t $image_tag . + docker build -q -t $image_tag . gcloud_login @@ -112,7 +112,7 @@ build_and_push_env_runtime() { image_tag=$2 pushd $ROOT/environments/$env/ - docker build -t $image_tag . + docker build -q -t $image_tag . gcloud_login @@ -127,7 +127,7 @@ build_and_push_env_builder() { pushd $ROOT/environments/$env/builder - docker build -t $image_tag --build-arg BUILDER_IMAGE=${builder_image} . + docker build -q -t $image_tag --build-arg BUILDER_IMAGE=${builder_image} . gcloud_login @@ -461,7 +461,7 @@ install_and_test() { clean_tpr_crd_resources id=$(generate_test_id) - #trap "helm_uninstall_fission $id" EXIT + trap "helm_uninstall_fission $id" EXIT if ! helm_install_fission $id $image $imageTag $fetcherImage $fetcherImageTag $controllerPort $routerPort $fluentdImage $fluentdImageTag $pruneInterval then describe_all_pods $id