-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Open
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
What version of Go are you using (go version
)?
$ go version go version go1.12.4 linux/amd64
Does this issue reproduce with the latest release?
Y
What operating system and processor architecture are you using (go env
)?
any
What did you do?
When serving a peak load, the system creates a lot of goroutines, and after that the goroutine garbages cause more CPU consuming.
This can be reproduced by:
package main
import (
"log"
"net/http"
_ "net/http/pprof"
"time"
)
func sayhello(wr http.ResponseWriter, r *http.Request) {}
func main() {
for i := 0; i < 1000000; i++ {
go func() {
time.Sleep(time.Second * 10)
}()
}
http.HandleFunc("/", sayhello)
err := http.ListenAndServe(":9090", nil)
if err != nil {
log.Fatal("ListenAndServe:", err)
}
}
after 10 seconds, the inuse objects still remain the same.
What did you expect to see?
The global goroutines shrink to a proper size.
What did you see instead?
Many inuse objects created by malg
zboya, lni, ddatsh, somnus-L, axfor and 15 more
Metadata
Metadata
Assignees
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.