出现了一个很奇怪的现象:
本地 Windows 环境开发一个接口,本地测试没问题后上传 git 仓库。
服务器 git pull 获取更新。
执行 php start.php reload(或 restart -d),此时请求新接口会 404 ,找不到新上传的代码,但是代码确实已经更新了。
或者不加新代码,改旧的代码也是没有反应过来,还是旧版本。
但是不知道过多久再请求又变成新代码的逻辑了,代码生效了。
但是再一次提交更新,又变回旧的逻辑了,代码又不生效了。
如上,一直反复。
-------------------------------------------- WORKERMAN --------------------------------------------
Workerman version:4.1.15 PHP version:8.2.24 Event-Loop:\Workerman\Events\Select
--------------------------------------------- WORKERS ---------------------------------------------
proto user worker listen processes status
tcp root webman http://0.0.0.0:8787 16 [OK]
tcp root monitor none 1 [OK]
---------------------------------------------------------------------------------------------------
有没一种可能代码没更新上去或是代码没拉下来.建议手动传一边试试
已确认,代码没问题
确认一下服务器更新的代码文件是否是你本地编辑过得的,打开确认一下
已确认,代码没问题
运行
ps auxf
看下是不是运行了多个webman。还有可能是请求走到其它服务器上去了,例如用了负载均衡或者域名有多个A记录等原因
域名确定只解析到了这一个服务器IP,也没有配置负载均衡啊。
[root@]# ps auxf
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
……
www 2946398 0.0 0.5 213960 42380 ? S 00:10 0:00 _ nginx: worker process
www 2946399 0.0 0.5 213960 39120 ? S 00:10 0:00 _ nginx: worker process
www 2946400 0.0 0.5 213960 39120 ? S 00:10 0:00 _ nginx: worker process
www 2946401 0.0 0.5 213960 39120 ? S 00:10 0:00 _ nginx: worker process
www 2946402 0.0 0.2 192620 18528 ? S 00:10 0:00 _ nginx: cache manager process
root 2188251 0.0 0.2 186084 15716 ? S Oct15 0:29 WorkerMan: worker process monitor
root 4189844 0.0 0.2 186084 16000 ? S Oct15 0:29 WorkerMan: worker process monitor
root 1804165 0.0 0.1 186084 15008 ? S Oct15 0:29 WorkerMan: worker process monitor
root 2339500 0.0 0.5 454344 45096 ? Ssl Oct15 0:01 /usr/libexec/platform-python -s /u
root 2343267 0.0 0.3 264864 24908 ? S Oct15 0:04 WorkerMan: worker process webman
root 2343268 0.0 0.2 188132 17888 ? S Oct15 0:04 WorkerMan: worker process webman
root 2343269 0.0 0.3 264864 25164 ? S Oct15 0:04 WorkerMan: worker process webman
root 2343270 0.0 0.3 264864 24916 ? S Oct15 0:04 WorkerMan: worker process webman
root 2343271 0.0 0.3 264864 25172 ? S Oct15 0:04 WorkerMan: worker process webman
root 2343272 0.0 0.2 188132 18056 ? S Oct15 0:02 WorkerMan: worker process webman
root 2343273 0.0 0.2 188132 18892 ? S Oct15 0:04 WorkerMan: worker process webman
root 2343274 0.0 0.2 188132 19652 ? S Oct15 0:04 WorkerMan: worker process webman
root 2343275 0.0 0.2 188132 18056 ? S Oct15 0:04 WorkerMan: worker process webman
root 2343276 0.0 0.3 264876 25692 ? S Oct15 0:03 WorkerMan: worker process webman
root 2343277 0.0 0.3 264876 24908 ? S Oct15 0:04 WorkerMan: worker process webman
root 2343278 0.0 0.3 264864 25744 ? S Oct15 0:04 WorkerMan: worker process webman
root 2343279 0.0 0.2 188132 19724 ? S Oct15 0:04 WorkerMan: worker process webman
root 2343280 0.0 0.3 264864 25712 ? S Oct15 0:04 WorkerMan: worker process webman
root 2343281 0.0 0.3 264864 25768 ? S Oct15 0:04 WorkerMan: worker process webman
root 2343282 0.0 0.2 186084 15752 ? S Oct15 0:28 WorkerMan: worker process monitor
root 2365108 0.0 0.2 188132 19600 ? S Oct16 0:03 WorkerMan: worker process webman
root 2365109 0.0 0.3 266912 27204 ? S Oct16 0:03 WorkerMan: worker process webman
root 2365110 0.0 0.3 264876 24924 ? S Oct16 0:04 WorkerMan: worker process webman
root 2365111 0.0 0.3 266912 27744 ? S Oct16 0:04 WorkerMan: worker process webman
root 2365112 0.0 0.3 264872 24620 ? S Oct16 0:04 WorkerMan: worker process webman
root 2365113 0.0 0.3 266912 26832 ? S Oct16 0:04 WorkerMan: worker process webman
root 2365114 0.0 0.3 264864 25008 ? S Oct16 0:04 WorkerMan: worker process webman
root 2365115 0.0 0.2 188132 17796 ? S Oct16 0:03 WorkerMan: worker process webman
root 2365116 0.0 0.3 264864 25580 ? S Oct16 0:04 WorkerMan: worker process webman
root 2365117 0.0 0.3 264880 25588 ? S Oct16 0:04 WorkerMan: worker process webman
root 2365118 0.0 0.3 264876 25748 ? S Oct16 0:04 WorkerMan: worker process webman
root 2365119 0.0 0.3 264864 24200 ? S Oct16 0:04 WorkerMan: worker process webman
root 2365120 0.0 0.3 264864 25720 ? S Oct16 0:04 WorkerMan: worker process webman
root 2365121 0.0 0.3 264880 25748 ? S Oct16 0:04 WorkerMan: worker process webman
root 2365122 0.0 0.3 264864 24716 ? S Oct16 0:04 WorkerMan: worker process webman
root 2365123 0.0 0.1 186084 14920 ? S Oct16 0:28 WorkerMan: worker process monitor
root 2368175 0.0 0.1 188768 12968 ? Ss Oct16 0:20 php-fpm: master process (/www/serv
www 2368176 0.0 0.3 290972 23828 ? S Oct16 0:00 _ php-fpm: pool www
www 2368177 0.0 0.3 290984 23792 ? S Oct16 0:00 _ php-fpm: pool www
www 2368178 0.0 0.3 290980 23832 ? S Oct16 0:00 _ php-fpm: pool www
www 2368179 0.0 0.3 290984 23828 ? S Oct16 0:00 _ php-fpm: pool www
www 2368180 0.0 0.3 290984 23800 ? S Oct16 0:00 _ php-fpm: pool www
www 2368181 0.0 0.3 290984 23824 ? S Oct16 0:00 _ php-fpm: pool www
www 2368183 0.0 0.3 290988 23888 ? S Oct16 0:00 _ php-fpm: pool www
www 2368184 0.0 0.3 290984 23784 ? S Oct16 0:00 _ php-fpm: pool www
www 2368185 0.0 0.3 290984 23708 ? S Oct16 0:00 _ php-fpm: pool www
www 2368186 0.0 0.3 290988 23792 ? S Oct16 0:00 _ php-fpm: pool www
www 2803872 0.0 0.3 290984 23816 ? S Oct24 0:00 _ php-fpm: pool www
root 2912581 0.0 0.0 53352 7604 ? Ssl Oct26 0:53 /usr/local/aegis/aegis_update/AliY
root 2912660 0.2 0.2 117692 15708 ? Ssl Oct26 5:04 /usr/local/aegis/aegis_client/aegi
root 2912671 0.5 0.5 191700 38904 ? Ssl Oct26 10:15 /usr/local/aegis/aegis_client/aegi
root 2936130 0.0 0.1 184036 14776 ? S Oct26 0:00 WorkerMan: master process start_f
root 2936131 0.0 0.2 186084 15892 ? S Oct26 0:00 _ WorkerMan: worker process web
root 2936132 0.0 0.2 186084 15892 ? S Oct26 0:00 _ WorkerMan: worker process web
root 2936133 0.0 0.2 186084 15892 ? S Oct26 0:00 _ WorkerMan: worker process web
root 2936134 0.0 0.2 186084 15892 ? S Oct26 0:00 _ WorkerMan: worker process web
root 2936135 0.0 0.2 186084 15892 ? S Oct26 0:00 _ WorkerMan: worker process web
root 2936136 0.0 0.2 186084 15892 ? S Oct26 0:00 _ WorkerMan: worker process web
root 2936137 0.0 0.2 186084 15892 ? S Oct26 0:00 _ WorkerMan: worker process web
root 2936138 0.0 0.2 186084 15892 ? S Oct26 0:00 _ WorkerMan: worker process web
root 2936140 0.0 0.2 186084 15892 ? S Oct26 0:00 _ WorkerMan: worker process web
root 2936141 0.0 0.2 186084 15892 ? S Oct26 0:00 _ WorkerMan: worker process web
root 2936142 0.0 0.2 186084 15892 ? S Oct26 0:00 _ WorkerMan: worker process web
root 2936143 0.0 0.2 186084 15892 ? S Oct26 0:00 _ WorkerMan: worker process web
root 2936144 0.0 0.2 186084 15892 ? S Oct26 0:00 _ WorkerMan: worker process web
root 2936145 0.0 0.2 186084 15892 ? S Oct26 0:00 _ WorkerMan: worker process web
root 2936146 0.0 0.2 186084 15892 ? S Oct26 0:00 _ WorkerMan: worker process web
root 2936147 0.0 0.2 186084 15892 ? S Oct26 0:00 _ WorkerMan: worker process web
root 2936148 0.0 0.2 186084 15636 ? S Oct26 0:00 _ WorkerMan: worker process mon
root 2982442 0.0 1.2 216968 96928 ? Ss 11:52 0:06 /usr/lib/systemd/systemd-journald
系统里存在其它webman进程
执行
ps aux|grep -i workerman|awk '{print $2}'|xargs kill -9
杀死所有workerman进程,然后重启webman试试php start.php stop && php start.php start -d。restart或者是reload,是不是一个一个重启的,不是所有的服务都立即重启,这个可能有个时间差。