`mcrypt_create_iv` Stalls, But Only Through Apache

2019-07-12 15:23发布

My local installation of PHP started doing this recently, but I don't know what changed and could have started this. It completely stalls out with 100% CPU utilization when I call mycrypt_create_iv, but only when that's called by Apache. When I call it from the CLI, it returns almost instantly. My test file is as follows:

<?php echo mcrypt_create_iv(16, MCRYPT_DEV_URANDOM);

The values are, of course, what the function was getting called with when I discovered this issue. This issue happens with either PHP 5.5 or 5.6, so I don't think it's the specific PHP version.

I'm running Gentoo Linux, so it's possible that the root cause was a build issue, but I've rebuilt libmcrypt, PHP, and Apache to no effect.

2条回答
Explosion°爆炸
2楼-- · 2019-07-12 15:37

After some experimentation, I got it.

I did not have APACHE2_MPMS set in make.conf, so it defaulted to the worker MPM. I set it to use prefork and this problem cleared away.

I did have the threads USE flag set, which conflicted with prefork and PHP, so I removed that use flag. With my profile, that meant that most packages with that flag still had it set, but php and mod_php disabled.

查看更多
兄弟一词,经得起流年.
3楼-- · 2019-07-12 15:54

seems a bug(https://bugs.php.net/bug.php?id=69833) of php which fixed in 5.6.13

查看更多
登录 后发表回答