2

我在 php 应用程序中有这样的行:

exec('uglifycss 1.css 2.css > main.css');

执行后,php-fpm 开始不停地重启所有子进程,这导致服务器上的 cpu 在几秒钟内达到 100%。只有 service php-fpm restart 可以挽救这种情况。应用程序的所有其他部分都运行良好,并且使用其他命令(uglifyjs、ssconvert、wkhtmltopdf)运行良好,只有这一行会导致这样的麻烦。

在 bash 中执行uglifycss效果很好,禁用 opcache 没有帮助,所有权限都正确,更改 uglifycss 版本没有帮助。该行本身运行良好 - 缩小文件出现在文件夹中。

php-fpm 日志:

[07-Jun-2017 00:10:39] NOTICE: fpm is running, pid 21162
[07-Jun-2017 00:10:39] NOTICE: ready to handle connections
[07-Jun-2017 00:10:39] NOTICE: systemd monitor interval set to 10000ms
[07-Jun-2017 00:10:59] NOTICE: [pool app] child 21199 exited with code 0 after 0.011741 seconds from start
[07-Jun-2017 00:10:59] NOTICE: [pool app] child 21200 started
[07-Jun-2017 00:10:59] NOTICE: [pool app] child 21200 exited with code 0 after 0.012848 seconds from start
[07-Jun-2017 00:10:59] NOTICE: [pool app] child 21201 started
[07-Jun-2017 00:10:59] NOTICE: [pool app] child 21201 exited with code 0 after 0.011070 seconds from start
[07-Jun-2017 00:10:59] NOTICE: [pool app] child 21202 started
[07-Jun-2017 00:10:59] NOTICE: [pool app] child 21202 exited with code 0 after 0.012875 seconds from start
[07-Jun-2017 00:10:59] NOTICE: [pool app] child 21203 started
[07-Jun-2017 00:10:59] NOTICE: [pool app] child 21203 exited with code 0 after 0.012139 seconds from start
[07-Jun-2017 00:10:59] NOTICE: [pool app] child 21204 started
[07-Jun-2017 00:10:59] NOTICE: [pool app] child 21204 exited with code 0 after 0.012334 seconds from start
[07-Jun-2017 00:10:59] NOTICE: [pool app] child 21205 started
[07-Jun-2017 00:10:59] NOTICE: [pool app] child 21205 exited with code 0 after 0.011729 seconds from start
[07-Jun-2017 00:10:59] NOTICE: [pool app] child 21206 started
[07-Jun-2017 00:10:59] NOTICE: [pool app] child 21206 exited with code 0 after 0.010936 seconds from start
[07-Jun-2017 00:10:59] NOTICE: [pool app] child 21207 started
[07-Jun-2017 00:10:59] NOTICE: [pool app] child 21207 exited with code 0 after 0.011194 seconds from start
[07-Jun-2017 00:10:59] NOTICE: [pool app] child 21208 started
[07-Jun-2017 00:10:59] NOTICE: [pool app] child 21208 exited with code 0 after 0.011382 seconds from start
[07-Jun-2017 00:10:59] NOTICE: [pool app] child 21209 started

依此类推,直到不会手动重新启动服务...

服务器信息:

CentOS 7, php 7.1.5, node 8.0.0, npm 5.0.0, uglifycss 0.0.27

好像是bug,有没有人遇到同样的问题?有什么解决办法吗?

4

1 回答 1

1

这是与在子进程中使用 exec/passthru 相关的 php-fpm 错误。这是由于对标准输入的争用。可以在此 PR 中看到修复:https ://github.com/php/php-src/pull/3287 ,它已合并到 php 7.1 中。

于 2018-09-19T15:31:32.820 回答