Skip to content

Commit

Permalink
fix: adds a nil check before stopping the ebpf hooks (keploy#1635)
Browse files Browse the repository at this point in the history
* fix: adds a nil check before stopping the ebpf hooks

* style: formats the changes in loader.go

Signed-off-by: re-Tick <[email protected]>

* style(proxy.go): formats and removes unwanted debug logs in proxy

Signed-off-by: re-Tick <[email protected]>

---------

Signed-off-by: re-Tick <[email protected]>
  • Loading branch information
re-Tick authored Mar 4, 2024
1 parent 28e14bf commit 4928947
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 6 additions & 0 deletions pkg/hooks/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ type Hook struct {
mutex sync.RWMutex
userAppCmd *exec.Cmd
userAppShutdownInitiated bool
isHooksLoaded bool
mainRoutineId int

// ebpf objects and events
Expand Down Expand Up @@ -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..")
Expand Down Expand Up @@ -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
}

Expand Down
2 changes: 0 additions & 2 deletions pkg/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 4928947

Please sign in to comment.