[php-src] Issue #11966: Microtime rate-limited?
| From: | dbuteyn | Date: | Mon, 14 Aug 2023 12:18:25 +0000 |
| Subject: | [php-src] Issue #11966: Microtime rate-limited? | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245178@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11966
Author: dbuteyn
### Description
Some of our automated tests would randomly fail.
During these tests, a value seeded with
microtime() was being hashed and inserted into
a database.
Either microtime() doesn't have enough precision or it is being cached somewhere
internally because occasionally the test would try to insert a duplicate hash and fail.
Considering that microtime() is supposed to have one millionth of a second precision, I
can only assume HPET requests are rate-limited in some way, somewhere.
Using /dev/urandom instead of microtime() solved the problem for us.
To reproduce:
Slam Apache server with libapache2-mod-php hard with a large number of concurrent requests that
print out microtime(). Eventually, one of the replies will have a duplicate value.
### PHP Version
PHP 7.4.33
### Operating System
Debian 11