shutdown

command
v0.0.0-...-b5285df Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

优雅重启测试

在 chrome 访问后,进程一直阻塞在 Shutdown 方法,直到 readTimeOut 或 把浏览器关闭

分析

浏览器上 conn 有四种状态 new,active,idle和closed,shutdown关闭时会关闭idle和closed的连接
在chrome浏览器中,为了复用请求提高性能,他会对后端产生,只有建立,没有发送数据的连接,也就是状态在new的连接,当shutdown触发时,这些连接是不会主动关闭的,只有readTineout触发后,new转换为closed状态后,shutdown才会关闭

解决

设置readTimeout
设置setKeepalive为false,禁止浏览器建立持久连接

safari没有这个问题,因为它不会预先建立持久连接

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL