diff --git a/pkg/hooks/loader.go b/pkg/hooks/loader.go index 3db2b95e7..a121d8afa 100755 --- a/pkg/hooks/loader.go +++ b/pkg/hooks/loader.go @@ -62,6 +62,7 @@ type Hook struct { mutex sync.RWMutex userAppCmd *exec.Cmd userAppShutdownInitiated bool + isHooksLoaded bool mainRoutineId int // ebpf objects and events @@ -583,6 +584,9 @@ func deleteFileIfExists(filename string, logger *zap.Logger) error { } func (h *Hook) Stop(forceStop bool) { + if !h.isHooksLoaded || h.socket == nil { + return + } if !forceStop && !h.IsUserAppTerminateInitiated() { h.logger.Info("Received signal to exit keploy program..") @@ -976,6 +980,8 @@ func (h *Hook) LoadHooks(appCmd, appContainer string, pid uint32, ctx context.Co h.SendAppPid(pid) } + // hooks are loaded so inform the state + h.isHooksLoaded = true return nil } diff --git a/pkg/proxy/proxy.go b/pkg/proxy/proxy.go index c2f27abf4..be9b44c16 100755 --- a/pkg/proxy/proxy.go +++ b/pkg/proxy/proxy.go @@ -356,8 +356,6 @@ func SetupCA(logger *zap.Logger, pid uint32, lang string) error { return err } - fmt.Println("set the certificate path in environment", os.Getenv("NODE_EXTRA_CA_CERTS")) - // for python err = os.Setenv("REQUESTS_CA_BUNDLE", tempCertPath) if err != nil {