Skip to content

Commit

Permalink
internal/transport: Unlock mutex before panic (#7488)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengjun2016 authored Aug 8, 2024
1 parent d00dd8f commit f9b96b8
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 f9b96b8

Please sign in to comment.