|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37840 uniqid() without more_entropy extremely slow
Submitted: 2006-06-18 17:21 UTC Modified: 2006-11-21 01:00 UTC
Avg. Score:4.5 ± 0.5
Reproduced:4 of 4 (100.0%)
Same Version:1 (25.0%)
Same OS:3 (75.0%)
From: diego at caravana dot to Assigned:
Status: No Feedback Package: Performance problem
PHP Version: 5.1.4 OS: Linux 2.4.21
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
46 + 37 = ?
Subscribe to this entry?

 [2006-06-18 17:21 UTC] diego at caravana dot to
See #37106 first.

Ok, this may be "bogus", but is there a workaround or some other unique id generator in PHP?
I've spent 2 days trying to figure out why my webapp was *so slow* on production server, when on develop/test environments it was acceptable... At last, I profiled (APD) it and discovered that uniqid() was terribly slow. I searched for some big problem in my app then, without any other clue, I commented out the usleep() call in uniqid.c: magically, a page that took 10 seconds now responded under 1 sec!
I tried with the following lines instead of usleep(), but with the same problem:

        struct timespec tsq;
        tsq.tv_sec = 0;
        tsq.tv_nsec = 1;
        nanosleep(&tsq, NULL);

FYI, I "patched" PHP 5.1.4, and the server with the problem runs an updated RHEL 3 (Linux 2.4.21-40.ELsmp).


Uniqid (last revision 2010-04-22 06:32 UTC by mwoolf at mcomi dot net)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-13 22:41 UTC]
Please try using this CVS snapshot:
For Windows:

 [2006-11-21 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2007-08-09 13:03 UTC] franz dot sedlmaier at gmx dot net
I can confirm this issue for newest PHP version (5.2.3).
 [2010-11-13 10:18 UTC] Mikhail dot V dot Gavrilov at gmail dot com
Comfirm this issue. PHP 5.3.3 Linux and Windows
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jun 20 19:01:30 2024 UTC