Skip to content

Commit

Permalink
internal/transport: Unlock mutex before panic (grpc#7488)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengjun2016 authored and infovivek2020 committed Aug 18, 2024
1 parent 19790bc commit 936542d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/transport/handler_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ func (ht *serverHandlerTransport) WriteStatus(s *Stream, st *status.Status) erro
}

s.hdrMu.Lock()
defer s.hdrMu.Unlock()
if p := st.Proto(); p != nil && len(p.Details) > 0 {
delete(s.trailer, grpcStatusDetailsBinHeader)
stBytes, err := proto.Marshal(p)
Expand All @@ -268,7 +269,6 @@ func (ht *serverHandlerTransport) WriteStatus(s *Stream, st *status.Status) erro
}
}
}
s.hdrMu.Unlock()
})

if err == nil { // transport has not been closed
Expand Down

0 comments on commit 936542d

Please sign in to comment.