{"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":20,"created_at":"2015-08-27T14:58:46Z","updated_at":"2015-09-07T12:45:45Z","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/138289212","html_url":"https://github.com/ramsey/uuid/issues/80#issuecomment-138289212","issue_url":"https://api.github.com/repos/ramsey/uuid/issues/80","id":138289212,"user":{"login":"renan","id":28046,"avatar_url":"https://avatars.githubusercontent.com/u/28046?v=3","gravatar_id":"","url":"https://api.github.com/users/renan","html_url":"https://github.com/renan","followers_url":"https://api.github.com/users/renan/followers","following_url":"https://api.github.com/users/renan/following{/other_user}","gists_url":"https://api.github.com/users/renan/gists{/gist_id}","starred_url":"https://api.github.com/users/renan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/renan/subscriptions","organizations_url":"https://api.github.com/users/renan/orgs","repos_url":"https://api.github.com/users/renan/repos","events_url":"https://api.github.com/users/renan/events{/privacy}","received_events_url":"https://api.github.com/users/renan/received_events","type":"User","site_admin":false},"created_at":"2015-09-07T12:45:45Z","updated_at":"2015-09-07T12:45:45Z","body":"I am logging the collisions to see how frequent they are, if any.\r\n\r\nIn the meantime I have executed the test script @aztech-dev provided in few machines:\r\n- No collisions on a 2.5M set when running on MacBook Pro with latest OS X, PHP 5.5.26, and OpenSSL 0.9.8zg\r\n- No collisions on a 23.7M set on Ubuntu 14.04.3 running PHP 5.5.9, and OpenSSL 1.0.1f\r\n\r\nThe server of which gave me collisions is not around anymore, but was running Ubuntu 12.04.4, PHP 5.3.x and don't know the OpenSSL version. But was all from Ubuntu LTS versions."}}