nginx官方文档表示-s reload时会等待旧的进程处理完请求后,旧的进程才会退出:
Once the master process receives the signal to reload configuration, it checks the syntax validity of the new configuration file and tries to apply the configuration provided in it. If this is a success, the master process starts new worker processes and sends messages to old worker processes, requesting them to shut down. Otherwise, the master process rolls back the changes and continues to work with the old configuration. Old worker processes, receiving a command to shut down, stop accepting new connections and continue to service current requests until all such requests are serviced. After that, the old worker processes exit.
这个描述的service current requests怎么理解呢,是指进程正在处理一些事情(比如nginx+lua,它正在运行lua代码),还是说是一定与某个客户端处于连接状态。
在我的项目中,基于openresty建立一个网关,当控制端同步数据到网关上,网关会存储数据到内存,当控制端发出POST请求,推送数据时,此时-s reload,新的进程起来后旧的进程立刻就退出了,导致一个请求的数据未成功同步到网关上。
我现在无法理解旧的进程是处于哪种状态才会等待处理完后才退出,而不是当新的进程起来后立刻就退出了旧进程。