Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
4.6.2
-
None
-
2ef8b92ececbf9d33d7c0b44f46c7c975fb0fdaa, a0fffeed6fceb8244328b649a3f6feb520493bc2, a736d333aab9e2e97fdbb738b3f3f4646afe192e, a736d333aab9e2e97fdbb738b3f3f4646afe192e, f28a27987fa4e1b2faa1c57188c128afb735f70a
Description
QUuid::createUuid does not seed the random number generator in certain cases, as the documentation says it should. This results in QUuid::createUuid creating an identical sequence of uuids from one process instance to the next.
To reproduce:
Run the attached test program several times. You can space out the program runs or seconds, minutes, or hours; it does not matter (i.e., this issue is distinct from QTBUG-8374)
Expected: A different sequence of uuids on each run.
Actual: An identical sequence of uuids.
An example run, along with the time the program was run:
$ date && ./test
Thu Jun 3 11:12:21 EDT 2010
"
"{aae9945b-f354-4d84-bb4e-64e588a89635}"
"{3faefaa6-b843-4363-9967-f3a5e3308339}"
$ date && ./test
Thu Jun 3 11:38:50 EDT 2010
"{b7203c47-06bf-4878-9ff5-6afffb2db546}
"
"
"{3faefaa6-b843-4363-9967-f3a5e3308339}"
$ date && ./test
Thu Jun 3 14:14:09 EDT 2010
"{b7203c47-06bf-4878-9ff5-6afffb2db546}"
"{aae9945b-f354-4d84-bb4e-64e588a89635}
"
"
"
More information:
- The problem will go away if the test program's call to qrand() is commented-out. Debugging into QUuid::createUuid, qsrand(), and qrand(), you will see how the call sequence in the test program results in the random number generator not being seeded.
- This is a regression. The test program behaves as expected with Qt 4.5.2.
- This appears to be an unintended consequence of commit 90a082c9, which is a fix for
QTBUG-3543.
- This issue was discovered in a production application where the problematic call to qrand() was not made by application code, but by QMapData::node_create.