Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Shutdown() function freezes execution if at least one request was performed (v1.31.0) #1190

Closed
waclawthedev opened this issue Jan 10, 2022 · 1 comment

Comments

@waclawthedev
Copy link

How to reproduce:

1. Execute the next code:

func main() {
	server := fasthttp.Server{Handler: func(ctx *fasthttp.RequestCtx) {
		ctx.WriteString("OK")
		return
	}}
	go server.ListenAndServe("0.0.0.0:8000")
	println("Press ENTER to shutdown")
	bufio.NewReader(os.Stdin).ReadString('\n')
	println("Shutdown ...")
	startTime := time.Now()
	server.Shutdown()
	fmt.Printf("%v", time.Since(startTime))
}

2. Try to press ENTER after performing requests on 127.0.0.1:8000. The output something like that:

Press ENTER to shutdown

Shutdown ...
36.1746735s

If you will try to press ENTER just after server started (without requests on 127.0.0.1:8000) - everything is ok:

Press ENTER to shutdown

Shutdown ...
101.211041ms
@erikdubbelboer
Copy link
Collaborator

This has been fixed by #1155 in the just released v1.32.0

This was referenced Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants