Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

internal/transport: Unlock mutex before panic #7488

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

fengjun2016
Copy link
Contributor

  1. Panic will not actively release the lock.
  2. This function is called by a goroutine, if panic occurs, the lock will be held until the entire program exits.
s.hdrMu.Lock()
if p := st.Proto(); p != nil && len(p.Details) > 0 {
	delete(s.trailer, grpcStatusDetailsBinHeader)
	stBytes, err := proto.Marshal(p)
	if err != nil {
		// TODO: return error instead, when callers are able to handle it.
		panic(err)
	}

	h.Set(grpcStatusDetailsBinHeader, encodeBinHeader(stBytes))
}

RELEASE NOTES: None

Copy link

codecov bot commented Aug 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.55%. Comparing base (e524655) to head (1ef7635).
Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7488      +/-   ##
==========================================
+ Coverage   81.40%   81.55%   +0.15%     
==========================================
  Files         357      357              
  Lines       27243    27224      -19     
==========================================
+ Hits        22176    22203      +27     
+ Misses       3850     3813      -37     
+ Partials     1217     1208       -9     
Files Coverage Δ
internal/transport/handler_server.go 88.00% <100.00%> (-1.34%) ⬇️

... and 22 files with indirect coverage changes

@easwars easwars added this to the 1.66 Release milestone Aug 7, 2024
@arvindbr8 arvindbr8 merged commit f9b96b8 into grpc:master Aug 8, 2024
13 checks passed
@fengjun2016 fengjun2016 deleted the bugfix/lock-release branch August 15, 2024 08:57
infovivek2020 pushed a commit to infovivek2020/grpc-go that referenced this pull request Aug 18, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants