php-fpm在执行uglifycss

时间:2017-06-06 21:25:07

标签: php centos uglifycss

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

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

执行后,php-fpm开始重启所有未停止的子节点,这会在几秒钟内导致服务器上的100%cpu。只有服务php-fpm restart才能保存这种情况。应用程序的所有其他部分运行良好,exec与其他命令(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

看起来像一个错误,是否有人有同样的问题?有没有解决这个问题?

1 个答案:

答案 0 :(得分:1)

这是一个与子进程中使用exec / passthru有关的php-fpm错误。这是由于对stdin的争用。可以在此PR:https://github.com/php/php-src/pull/3287中看到此修复程序,该PR已合并到php 7.1中。