Bug Description
The Fiber HTTP client's execFunc() goroutine has no recover(). If fasthttp.Do(), any hook, or CopyTo() panics, the entire process crashes. The channels are also never drained, causing the caller to hang or leak.
How to Reproduce
Steps to reproduce the behavior:
- Use the Fiber client with a custom hook that panics
- Call
req.Send()
- The panic propagates through the goroutine and crashes the server
Affected Code
client/core.go:80-136:
go func() {
defer releaseErrChan(errChan)
defer releaseResponseChan(respChan)
// ... HTTP execution logic ...
respChan <- resp // never reached if panic occurs
}()
Expected Behavior
Add panic recovery that sends the error through the channel:
go func() {
defer releaseErrChan(errChan)
defer releaseResponseChan(respChan)
defer func() {
if r := recover(); r != nil {
errChan <- fmt.Errorf("client panic: %v", r)
}
}()
// ... existing logic ...
}()
Related
Fiber Version
v3 (latest main branch)
Bug Description
The Fiber HTTP client's
execFunc()goroutine has norecover(). Iffasthttp.Do(), any hook, orCopyTo()panics, the entire process crashes. The channels are also never drained, causing the caller to hang or leak.How to Reproduce
Steps to reproduce the behavior:
req.Send()Affected Code
client/core.go:80-136:Expected Behavior
Add panic recovery that sends the error through the channel:
Related
Fiber Version
v3 (latest main branch)