🐛 bug: Handle panics in client execFunc without crashing callers#4365
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix panic recovery in execFunc goroutine for Fiber HTTP client
Handle panics in client execFunc without crashing callers
May 28, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4365 +/- ##
==========================================
- Coverage 91.39% 91.33% -0.06%
==========================================
Files 132 132
Lines 13098 13104 +6
==========================================
- Hits 11971 11969 -2
- Misses 710 716 +6
- Partials 417 419 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the Fiber client execution path by containing panics raised during asynchronous request execution and returning them as normal client errors instead of allowing goroutine panics to crash the process.
Changes:
- Adds panic recovery in
client.execFunc()and reports recovered panics through the existing error channel. - Releases any partially acquired client
Responseduring panic recovery. - Adds regression coverage with a panicking transport implementation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
client/core.go |
Adds panic recovery and panic-to-error conversion inside the request execution goroutine. |
client/core_test.go |
Adds a test transport that panics and verifies execFunc() returns an error with no response. |
ReneWerner87
approved these changes
May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
client.execFunc()launched request execution in a goroutine without panic recovery. A panic from the transport path could terminate the process and leave the caller blocked waiting on pooled channels.Changes introduced
Panic containment in
execFuncrecover()path around the goroutine body inclient/core.go.client panic: ...errors sent througherrChanso callers fail normally instead of crashing.Pool/resource safety
Responsebefore reporting the panic.Regression coverage
execFunc()returns an error and no response.Type of change
Please delete options that are not relevant.
Checklist
Before you submit your pull request, please make sure you meet these requirements:
/docs/directory for Fiber's documentation.Commit formatting
Please use emojis in commit messages for an easy way to identify the purpose or intention of a commit. Check out the emoji cheatsheet here: CONTRIBUTING.md