-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Description
Version info:
- Go:
go1.23.10 windows/amd64 - Fasthttp:
v1.63.0
What happened
When running a simple fasthttp server and testing it using a Slowloris attack (via goloris), the memory usage of the fasthttp process increases rapidly and does not decrease for many minutes even after the attack ends.
Code
package main
import (
"github.com/valyala/fasthttp"
)
func main() {
requestHandler := func(ctx *fasthttp.RequestCtx) {
switch string(ctx.Path()) {
case "/":
ctx.SetStatusCode(fasthttp.StatusOK)
ctx.SetBody([]byte("Hello, World!"))
default:
ctx.SetStatusCode(fasthttp.StatusNotFound)
ctx.SetBody([]byte(""))
}
}
if err := fasthttp.ListenAndServe(":3000", requestHandler); err != nil {
panic("Server Error: " + err.Error())
}
}Task Manager
PPROF
| flat | flat% | sum% | cum | cum% | Function |
|---|---|---|---|---|---|
| 231.30MB | 98.93% | 98.93% | 231.30MB | 98.93% | github.com/valyala/fasthttp.appendBodyFixedSize |
| 0 | 0% | 98.93% | 231.30MB | 98.93% | github.com/valyala/fasthttp.(*Request).ContinueReadBody |
| 0 | 0% | 98.93% | 231.30MB | 98.93% | github.com/valyala/fasthttp.(*Request).ReadBody |
| 0 | 0% | 98.93% | 231.30MB | 98.93% | github.com/valyala/fasthttp.(*Request).readLimitBody |
| 0 | 0% | 98.93% | 232.81MB | 99.57% | github.com/valyala/fasthttp.(*Server).serveConn |
| 0 | 0% | 98.93% | 232.81MB | 99.57% | github.com/valyala/fasthttp.(*workerPool).getCh.func1 |
| 0 | 0% | 98.93% | 232.81MB | 99.57% | github.com/valyala/fasthttp.(*workerPool).workerFunc |
| 0 | 0% | 98.93% | 231.30MB | 98.93% | github.com/valyala/fasthttp.readBody |
Metadata
Metadata
Assignees
Labels
No labels