From 2ceaae8e54dec42b1878bfd23733ef787d67724b Mon Sep 17 00:00:00 2001 From: Travis Groth Date: Wed, 30 Jun 2021 14:18:43 -0400 Subject: [PATCH] internal/envoy: add debugging information if envoy is no longer running (#2320) --- internal/envoy/envoy.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/internal/envoy/envoy.go b/internal/envoy/envoy.go index 815e90a16..f80186788 100644 --- a/internal/envoy/envoy.go +++ b/internal/envoy/envoy.go @@ -380,7 +380,24 @@ func (srv *Server) monitorProcess(ctx context.Context, pid int32) { Int32("pid", pid). Msg("envoy: error retrieving subprocess status") } else if !running { + origCtime, err := proc.CreateTimeWithContext(ctx) + if err != nil { + log.Error(ctx).Err(err).Msg("envoy: failed to get original creation time") + } + + newProc, err := process.NewProcessWithContext(ctx, pid) + if err != nil { + log.Error(ctx).Err(err).Msg("envoy: failed to get new process handle") + } + newCtime, err := newProc.CreateTimeWithContext(ctx) + if err != nil { + log.Error(ctx).Err(err).Msg("envoy: failed to get new creation time") + } + log.Fatal().Err(err). + Int64("original-creation-time", origCtime). + Int64("new-creation-time", newCtime). + Int64("delta-creation-time", newCtime-origCtime). Int32("pid", pid). Msg("envoy: subprocess exited") }