From 7258ecb2ed7396d35f814251fc942d3517a48522 Mon Sep 17 00:00:00 2001 From: Forrest Marshall Date: Thu, 18 Jul 2024 13:17:33 -0700 Subject: [PATCH] fix panic during audit upload --- api/client/auditstreamer.go | 2 +- lib/events/filesessions/fileasync.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/api/client/auditstreamer.go b/api/client/auditstreamer.go index ad2d1eb73b920..a6149dd410020 100644 --- a/api/client/auditstreamer.go +++ b/api/client/auditstreamer.go @@ -153,8 +153,8 @@ func (s *auditStreamer) recv() { } func (s *auditStreamer) closeWithError(err error) { - s.cancel() s.mu.Lock() defer s.mu.Unlock() s.err = err + s.cancel() } diff --git a/lib/events/filesessions/fileasync.go b/lib/events/filesessions/fileasync.go index 4ef4513af27f2..4643c1d51fbf2 100644 --- a/lib/events/filesessions/fileasync.go +++ b/lib/events/filesessions/fileasync.go @@ -532,7 +532,9 @@ func (u *Uploader) upload(ctx context.Context, up *upload) error { return trace.Errorf("operation has been canceled, uploader is closed") case <-stream.Done(): if errStream, ok := stream.(interface{ Error() error }); ok { - return trace.ConnectionProblem(errStream.Error(), errStream.Error().Error()) + if err := errStream.Error(); err != nil { + return trace.ConnectionProblem(err, err.Error()) + } } return trace.ConnectionProblem(nil, "upload stream terminated unexpectedly")