我的业务中有个模块,可能需要执行1-2分钟。
当 php start.php start 模式下(方便直接修改直接调试),文件热更新后 阻塞进程exit with status 9
能不能实现热更新后,不要影响正在执行中的进程,先把空闲进程热更新掉,耗时的进程等待完成后在去更新呢?
config/process.php 里给对应的进程设置一个
'reloadable' => false,
这样收到进程realod信号这个进程就跳过了,不会重启
好使!老大给力!这个问题令我头疼很久了。刚发了问题老大能够10分钟内回复并解决。workerman 永远滴神!
哎老大,有个问题。reloadable 设置 false后,重新restart服务。此时,我在当前进程执行1-2分钟的业务时候我更新了代码,进程没有被强制退出,OK没问题。当这个进程执行完毕之后,为什么还是没有被热更新呢(走最新代码的逻辑)。我webman服务开了8个进程,即使这个进程不更新了,那其它进程也该已经完成热更新了?感觉其它进程都没有被热更新,还得restart重启服务后才行 [root@iZ2ze8me45214ucqx7qkj4Z webman]# php start.php status Workerman[start.php] status Start worker in DEBUG mode. ---------------------------------------------------GLOBAL STATUS--------------------------------------------------------- Workerman/5.1.5 PHP/8.1.32 (JIT on) Linux/5.10.134-18.al8.x86_64 start time:2025-11-19 15:38:38 run 0 days 0 hours load average: 0.08, 0.03, 0 2 workers 9 processes name event-loop exit_status exit_count webman event 0 0 monitor event 0 0 ---------------------------------------------------PROCESS STATUS-------------------------------------------------------- pid memory listening name connections send_fail timers total_request qps status 484065 1.09M http://0.0.0.0:8787 webman 0 0 2 8 0 [idle] 484066 0.86M http://0.0.0.0:8787 webman 0 0 1 5 0 [idle] 484067 0.98M http://0.0.0.0:8787 webman 0 0 3 7 0 [idle] 484068 0.83M http://0.0.0.0:8787 webman 0 0 1 3 0 [idle] 484069 3.24M http://0.0.0.0:8787 webman 0 1 3 12 0 [idle] 484070 2.35M http://0.0.0.0:8787 webman 0 0 3 60 0 [idle] 484071 2.82M http://0.0.0.0:8787 webman 0 0 3 16 0 [idle] 484072 0.89M http://0.0.0.0:8787 webman 0 0 2 6 0 [idle] 484073 0.66M none monitor 0 0 2 0 0 [idle] ---------------------------------------------------PROCESS STATUS-------------------------------------------------------- Summary 13.72M - - 0 1 20 117 0 [Summary]
reloadable为false是指让这个进程不执行reload更新,不会更新代码。 reloadable为false适合用在业务代码更新不频繁的进程里,例如webman自带的Monitor进程。
如果你想让它执行完毕后再更新去掉之前的reloadable设置,然后设置 config/server.php 的
'stop_timeout' => 2 * 60,
含义是 进程收到reload/stop信号后最大超时时间 2 * 60 秒,超过这个时间如果进程还没执行完任务则kill -9 并出现日志 exit with status 9
可以!这样能满足我的需求了,感谢老大,webman还是太全面了。
config/process.php 里给对应的进程设置一个
这样收到进程realod信号这个进程就跳过了,不会重启
好使!老大给力!这个问题令我头疼很久了。刚发了问题老大能够10分钟内回复并解决。workerman 永远滴神!
哎老大,有个问题。reloadable 设置 false后,重新restart服务。此时,我在当前进程执行1-2分钟的业务时候我更新了代码,进程没有被强制退出,OK没问题。当这个进程执行完毕之后,为什么还是没有被热更新呢(走最新代码的逻辑)。我webman服务开了8个进程,即使这个进程不更新了,那其它进程也该已经完成热更新了?感觉其它进程都没有被热更新,还得restart重启服务后才行
[root@iZ2ze8me45214ucqx7qkj4Z webman]# php start.php status
Workerman[start.php] status
Start worker in DEBUG mode.
---------------------------------------------------GLOBAL STATUS---------------------------------------------------------
Workerman/5.1.5 PHP/8.1.32 (JIT on) Linux/5.10.134-18.al8.x86_64
start time:2025-11-19 15:38:38 run 0 days 0 hours load average: 0.08, 0.03, 0
2 workers 9 processes
name event-loop exit_status exit_count
webman event 0 0
monitor event 0 0
---------------------------------------------------PROCESS STATUS--------------------------------------------------------
pid memory listening name connections send_fail timers total_request qps status
484065 1.09M http://0.0.0.0:8787 webman 0 0 2 8 0 [idle]
484066 0.86M http://0.0.0.0:8787 webman 0 0 1 5 0 [idle]
484067 0.98M http://0.0.0.0:8787 webman 0 0 3 7 0 [idle]
484068 0.83M http://0.0.0.0:8787 webman 0 0 1 3 0 [idle]
484069 3.24M http://0.0.0.0:8787 webman 0 1 3 12 0 [idle]
484070 2.35M http://0.0.0.0:8787 webman 0 0 3 60 0 [idle]
484071 2.82M http://0.0.0.0:8787 webman 0 0 3 16 0 [idle]
484072 0.89M http://0.0.0.0:8787 webman 0 0 2 6 0 [idle]
484073 0.66M none monitor 0 0 2 0 0 [idle]
---------------------------------------------------PROCESS STATUS--------------------------------------------------------
Summary 13.72M - - 0 1 20 117 0 [Summary]
reloadable为false是指让这个进程不执行reload更新,不会更新代码。
reloadable为false适合用在业务代码更新不频繁的进程里,例如webman自带的Monitor进程。
如果你想让它执行完毕后再更新去掉之前的reloadable设置,然后设置 config/server.php 的
含义是 进程收到reload/stop信号后最大超时时间 2 * 60 秒,超过这个时间如果进程还没执行完任务则kill -9 并出现日志 exit with status 9
可以!这样能满足我的需求了,感谢老大,webman还是太全面了。