{"action":"created","issue":{"url":"https://api.github.com/repos/ramsey/uuid/issues/80","labels_url":"https://api.github.com/repos/ramsey/uuid/issues/80/labels{/name}","comments_url":"https://api.github.com/repos/ramsey/uuid/issues/80/comments","events_url":"https://api.github.com/repos/ramsey/uuid/issues/80/events","html_url":"https://github.com/ramsey/uuid/issues/80","id":103529643,"number":80,"title":"Uuid:uuid4() collisions","user":{"login":"giorgiosironi","id":160299,"avatar_url":"https://avatars.githubusercontent.com/u/160299?v=3","gravatar_id":"","url":"https://api.github.com/users/giorgiosironi","html_url":"https://github.com/giorgiosironi","followers_url":"https://api.github.com/users/giorgiosironi/followers","following_url":"https://api.github.com/users/giorgiosironi/following{/other_user}","gists_url":"https://api.github.com/users/giorgiosironi/gists{/gist_id}","starred_url":"https://api.github.com/users/giorgiosironi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giorgiosironi/subscriptions","organizations_url":"https://api.github.com/users/giorgiosironi/orgs","repos_url":"https://api.github.com/users/giorgiosironi/repos","events_url":"https://api.github.com/users/giorgiosironi/events{/privacy}","received_events_url":"https://api.github.com/users/giorgiosironi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":41,"created_at":"2015-08-27T14:58:46Z","updated_at":"2016-01-04T19:09:36Z","closed_at":null,"body":"We are generating about 1M UUID4 a day, and we are getting several hundred collisions a day, such as:\r\n```\r\n[2015-08-26 21:29:19 +0200] [production-onebipws-1.apache - 17819] [DEBUG] [Request] \r\ntime_total=0.145\r\n\"request_id\":\"fdfb98c1-4367-4f22-b68a-d7cdaedcc069\" \r\n\r\n[2015-08-27 00:36:16 +0200] [production-onebipws-1.apache - 17819] [DEBUG] [Request] \r\ntime_total=0.016\r\n\"request_id\":\"fdfb98c1-4367-4f22-b68a-d7cdaedcc069\"\r\n```\r\nThe issue seem to be correlated with the same Apache process regenerating the same UUID after several hours. It also seem to be correlated with particular EC2 machines which presents the problem.\r\n\r\nWe checked to have `openssl_random_pseudo_bytes` and if it was using a strong algorithm:\r\n```\r\nroot@dev-all-onebip:~/projects/.../onebip-ultimate$  (master) # php -r \"var_dump(function_exists('openssl_random_pseudo_bytes'));\"                                      \r\nbool(true)\r\nroot@dev-all-onebip:~/projects/.../onebip-ultimate$  (master) # php -r 'openssl_random_pseudo_bytes(16, $strong); var_dump($strong);'\r\nbool(true)\r\n```\r\n\r\nHow can we debug this problem?"},"comment":{"url":"https://api.github.com/repos/ramsey/uuid/issues/comments/168773188","html_url":"https://github.com/ramsey/uuid/issues/80#issuecomment-168773188","issue_url":"https://api.github.com/repos/ramsey/uuid/issues/80","id":168773188,"user":{"login":"ramsey","id":42941,"avatar_url":"https://avatars.githubusercontent.com/u/42941?v=3","gravatar_id":"","url":"https://api.github.com/users/ramsey","html_url":"https://github.com/ramsey","followers_url":"https://api.github.com/users/ramsey/followers","following_url":"https://api.github.com/users/ramsey/following{/other_user}","gists_url":"https://api.github.com/users/ramsey/gists{/gist_id}","starred_url":"https://api.github.com/users/ramsey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ramsey/subscriptions","organizations_url":"https://api.github.com/users/ramsey/orgs","repos_url":"https://api.github.com/users/ramsey/repos","events_url":"https://api.github.com/users/ramsey/events{/privacy}","received_events_url":"https://api.github.com/users/ramsey/received_events","type":"User","site_admin":false},"created_at":"2016-01-04T19:09:36Z","updated_at":"2016-01-04T19:09:36Z","body":"@clphillips As @jyggen stated, what you are seeing is the expected behavior for version 3 and 5 UUIDs. To further clarify, you are seeing `Ramsey\\Uuid\\Generator\\OpenSslGenerator` each time with the output of `get_class($uuid->getFactory()->getRandomGenerator())` because that is the random generator you would be using if you were generating random UUIDs (version 4), but versions 3 and 5 do not use the random generator."}}