payload: {"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/comments/255338237","pull_request_review_id":201904107,"id":255338237,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI1NTMzODIzNw==","diff_hunk":"@@ -2,9 +2,32 @@ local _M = {}\n \n local seeds = {}\n local original_randomseed = math.randomseed\n+\n+local function get_seed_from_urandom()\n+  local seed\n+  local frandom, err = io.open(\"/dev/urandom\", \"rb\")\n+  if not frandom then\n+    ngx.log(ngx.WARN, 'failed to open /dev/urandom: ', err)\n+    return nil\n+  end\n+\n+  local str = frandom:read(4)\n+  frandom:close()\n+  if not str then\n+    ngx.log(ngx.WARN, 'failed to read data from /dev/urandom')\n+    return nil\n+  end\n+\n+  seed = 0\n+  for i = 1, 4 do\n+      seed = 256 * seed + str:byte(i)\n+  end","path":"rootfs/etc/nginx/lua/lua_ingress.lua","position":23,"original_position":23,"commit_id":"8ea7501d8b4f14b748ef2c8d00e617ca16c43b9a","original_commit_id":"8ea7501d8b4f14b748ef2c8d00e617ca16c43b9a","user":{"login":"moonming","id":26448043,"node_id":"MDQ6VXNlcjI2NDQ4MDQz","avatar_url":"https://avatars1.githubusercontent.com/u/26448043?v=4","gravatar_id":"","url":"https://api.github.com/users/moonming","html_url":"https://github.com/moonming","followers_url":"https://api.github.com/users/moonming/followers","following_url":"https://api.github.com/users/moonming/following{/other_user}","gists_url":"https://api.github.com/users/moonming/gists{/gist_id}","starred_url":"https://api.github.com/users/moonming/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moonming/subscriptions","organizations_url":"https://api.github.com/users/moonming/orgs","repos_url":"https://api.github.com/users/moonming/repos","events_url":"https://api.github.com/users/moonming/events{/privacy}","received_events_url":"https://api.github.com/users/moonming/received_events","type":"User","site_admin":false},"body":"both solutions are ok, however, if we used the `tonumber`, we need one more function call, and one more table to contact the 4 bytes.\r\nBTW, there is 4 bytes, so we don't need to consider number overflow.","created_at":"2019-02-10T13:44:27Z","updated_at":"2019-02-10T13:44:27Z","html_url":"https://github.com/kubernetes/ingress-nginx/pull/3671#discussion_r255338237","pull_request_url":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/3671","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/comments/255338237"},"html":{"href":"https://github.com/kubernetes/ingress-nginx/pull/3671#discussion_r255338237"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/3671"}},"in_reply_to_id":249642647},"pull_request":{"url":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/3671","id":245567748,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQ1NTY3NzQ4","html_url":"https://github.com/kubernetes/ingress-nginx/pull/3671","diff_url":"https://github.com/kubernetes/ingress-nginx/pull/3671.diff","patch_url":"https://github.com/kubernetes/ingress-nginx/pull/3671.patch","issue_url":"https://api.github.com/repos/kubernetes/ingress-nginx/issues/3671","number":3671,"state":"open","locked":false,"title":"bugfix: fixed duplicated seeds.","user":{"login":"moonming","id":26448043,"node_id":"MDQ6VXNlcjI2NDQ4MDQz","avatar_url":"https://avatars1.githubusercontent.com/u/26448043?v=4","gravatar_id":"","url":"https://api.github.com/users/moonming","html_url":"https://github.com/moonming","followers_url":"https://api.github.com/users/moonming/followers","following_url":"https://api.github.com/users/moonming/following{/other_user}","gists_url":"https://api.github.com/users/moonming/gists{/gist_id}","starred_url":"https://api.github.com/users/moonming/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moonming/subscriptions","organizations_url":"https://api.github.com/users/moonming/orgs","repos_url":"https://api.github.com/users/moonming/repos","events_url":"https://api.github.com/users/moonming/events{/privacy}","received_events_url":"https://api.github.com/users/moonming/received_events","type":"User","site_admin":false},"body":"<!--  Thanks for sending a pull request!  Here are some tips for you:\r\n1. If this is your first time, read our contributor guidelines https://git.k8s.io/community/contributors/guide/pull-requests.md#the-pull-request-submit-process and developer guide https://git.k8s.io/community/contributors/devel/development.md#development-guide\r\n2. If you want *faster* PR reviews, read how: https://git.k8s.io/community/contributors/guide/pull-requests.md#best-practices-for-faster-reviews\r\n-->\r\n\r\n**What this PR does / why we need it**:\r\nngx.time() + ngx.worker.pid() maybe get duplicated seeds. get from /dev/urandom first.\r\n\r\n**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #\r\n\r\n**Special notes for your reviewer**:\r\n","created_at":"2019-01-17T16:38:41Z","updated_at":"2019-02-10T13:44:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1c8c5325f2b5861406e58fd2ea5cfd0dad9d6f27","assignee":{"login":"ElvinEfendi","id":1150042,"node_id":"MDQ6VXNlcjExNTAwNDI=","avatar_url":"https://avatars0.githubusercontent.com/u/1150042?v=4","gravatar_id":"","url":"https://api.github.com/users/ElvinEfendi","html_url":"https://github.com/ElvinEfendi","followers_url":"https://api.github.com/users/ElvinEfendi/followers","following_url":"https://api.github.com/users/ElvinEfendi/following{/other_user}","gists_url":"https://api.github.com/users/ElvinEfendi/gists{/gist_id}","starred_url":"https://api.github.com/users/ElvinEfendi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ElvinEfendi/subscriptions","organizations_url":"https://api.github.com/users/ElvinEfendi/orgs","repos_url":"https://api.github.com/users/ElvinEfendi/repos","events_url":"https://api.github.com/users/ElvinEfendi/events{/privacy}","received_events_url":"https://api.github.com/users/ElvinEfendi/received_events","type":"User","site_admin":false},"assignees":[{"login":"ElvinEfendi","id":1150042,"node_id":"MDQ6VXNlcjExNTAwNDI=","avatar_url":"https://avatars0.githubusercontent.com/u/1150042?v=4","gravatar_id":"","url":"https://api.github.com/users/ElvinEfendi","html_url":"https://github.com/ElvinEfendi","followers_url":"https://api.github.com/users/ElvinEfendi/followers","following_url":"https://api.github.com/users/ElvinEfendi/following{/other_user}","gists_url":"https://api.github.com/users/ElvinEfendi/gists{/gist_id}","starred_url":"https://api.github.com/users/ElvinEfendi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ElvinEfendi/subscriptions","organizations_url":"https://api.github.com/users/ElvinEfendi/orgs","repos_url":"https://api.github.com/users/ElvinEfendi/repos","events_url":"https://api.github.com/users/ElvinEfendi/events{/privacy}","received_events_url":"https://api.github.com/users/ElvinEfendi/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"aledbf","id":161571,"node_id":"MDQ6VXNlcjE2MTU3MQ==","avatar_url":"https://avatars2.githubusercontent.com/u/161571?v=4","gravatar_id":"","url":"https://api.github.com/users/aledbf","html_url":"https://github.com/aledbf","followers_url":"https://api.github.com/users/aledbf/followers","following_url":"https://api.github.com/users/aledbf/following{/other_user}","gists_url":"https://api.github.com/users/aledbf/gists{/gist_id}","starred_url":"https://api.github.com/users/aledbf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aledbf/subscriptions","organizations_url":"https://api.github.com/users/aledbf/orgs","repos_url":"https://api.github.com/users/aledbf/repos","events_url":"https://api.github.com/users/aledbf/events{/privacy}","received_events_url":"https://api.github.com/users/aledbf/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":486873161,"node_id":"MDU6TGFiZWw0ODY4NzMxNjE=","url":"https://api.github.com/repos/kubernetes/ingress-nginx/labels/cncf-cla:%20yes","name":"cncf-cla: yes","color":"bfe5bf","default":false},{"id":676670532,"node_id":"MDU6TGFiZWw2NzY2NzA1MzI=","url":"https://api.github.com/repos/kubernetes/ingress-nginx/labels/size/M","name":"size/M","color":"eebb00","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/3671/commits","review_comments_url":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/3671/comments","review_comment_url":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/ingress-nginx/issues/3671/comments","statuses_url":"https://api.github.com/repos/kubernetes/ingress-nginx/statuses/8ea7501d8b4f14b748ef2c8d00e617ca16c43b9a","head":{"label":"moonming:randomseed-bugfix","ref":"randomseed-bugfix","sha":"8ea7501d8b4f14b748ef2c8d00e617ca16c43b9a","user":{"login":"moonming","id":26448043,"node_id":"MDQ6VXNlcjI2NDQ4MDQz","avatar_url":"https://avatars1.githubusercontent.com/u/26448043?v=4","gravatar_id":"","url":"https://api.github.com/users/moonming","html_url":"https://github.com/moonming","followers_url":"https://api.github.com/users/moonming/followers","following_url":"https://api.github.com/users/moonming/following{/other_user}","gists_url":"https://api.github.com/users/moonming/gists{/gist_id}","starred_url":"https://api.github.com/users/moonming/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moonming/subscriptions","organizations_url":"https://api.github.com/users/moonming/orgs","repos_url":"https://api.github.com/users/moonming/repos","events_url":"https://api.github.com/users/moonming/events{/privacy}","received_events_url":"https://api.github.com/users/moonming/received_events","type":"User","site_admin":false},"repo":{"id":166184745,"node_id":"MDEwOlJlcG9zaXRvcnkxNjYxODQ3NDU=","name":"ingress-nginx","full_name":"moonming/ingress-nginx","private":false,"owner":{"login":"moonming","id":26448043,"node_id":"MDQ6VXNlcjI2NDQ4MDQz","avatar_url":"https://avatars1.githubusercontent.com/u/26448043?v=4","gravatar_id":"","url":"https://api.github.com/users/moonming","html_url":"https://github.com/moonming","followers_url":"https://api.github.com/users/moonming/followers","following_url":"https://api.github.com/users/moonming/following{/other_user}","gists_url":"https://api.github.com/users/moonming/gists{/gist_id}","starred_url":"https://api.github.com/users/moonming/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moonming/subscriptions","organizations_url":"https://api.github.com/users/moonming/orgs","repos_url":"https://api.github.com/users/moonming/repos","events_url":"https://api.github.com/users/moonming/events{/privacy}","received_events_url":"https://api.github.com/users/moonming/received_events","type":"User","site_admin":false},"html_url":"https://github.com/moonming/ingress-nginx","description":"NGINX Ingress Controller for Kubernetes","fork":true,"url":"https://api.github.com/repos/moonming/ingress-nginx","forks_url":"https://api.github.com/repos/moonming/ingress-nginx/forks","keys_url":"https://api.github.com/repos/moonming/ingress-nginx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/moonming/ingress-nginx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/moonming/ingress-nginx/teams","hooks_url":"https://api.github.com/repos/moonming/ingress-nginx/hooks","issue_events_url":"https://api.github.com/repos/moonming/ingress-nginx/issues/events{/number}","events_url":"https://api.github.com/repos/moonming/ingress-nginx/events","assignees_url":"https://api.github.com/repos/moonming/ingress-nginx/assignees{/user}","branches_url":"https://api.github.com/repos/moonming/ingress-nginx/branches{/branch}","tags_url":"https://api.github.com/repos/moonming/ingress-nginx/tags","blobs_url":"https://api.github.com/repos/moonming/ingress-nginx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/moonming/ingress-nginx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/moonming/ingress-nginx/git/refs{/sha}","trees_url":"https://api.github.com/repos/moonming/ingress-nginx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/moonming/ingress-nginx/statuses/{sha}","languages_url":"https://api.github.com/repos/moonming/ingress-nginx/languages","stargazers_url":"https://api.github.com/repos/moonming/ingress-nginx/stargazers","contributors_url":"https://api.github.com/repos/moonming/ingress-nginx/contributors","subscribers_url":"https://api.github.com/repos/moonming/ingress-nginx/subscribers","subscription_url":"https://api.github.com/repos/moonming/ingress-nginx/subscription","commits_url":"https://api.github.com/repos/moonming/ingress-nginx/commits{/sha}","git_commits_url":"https://api.github.com/repos/moonming/ingress-nginx/git/commits{/sha}","comments_url":"https://api.github.com/repos/moonming/ingress-nginx/comments{/number}","issue_comment_url":"https://api.github.com/repos/moonming/ingress-nginx/issues/comments{/number}","contents_url":"https://api.github.com/repos/moonming/ingress-nginx/contents/{+path}","compare_url":"https://api.github.com/repos/moonming/ingress-nginx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/moonming/ingress-nginx/merges","archive_url":"https://api.github.com/repos/moonming/ingress-nginx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/moonming/ingress-nginx/downloads","issues_url":"https://api.github.com/repos/moonming/ingress-nginx/issues{/number}","pulls_url":"https://api.github.com/repos/moonming/ingress-nginx/pulls{/number}","milestones_url":"https://api.github.com/repos/moonming/ingress-nginx/milestones{/number}","notifications_url":"https://api.github.com/repos/moonming/ingress-nginx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/moonming/ingress-nginx/labels{/name}","releases_url":"https://api.github.com/repos/moonming/ingress-nginx/releases{/id}","deployments_url":"https://api.github.com/repos/moonming/ingress-nginx/deployments","created_at":"2019-01-17T07:56:57Z","updated_at":"2019-01-17T07:57:01Z","pushed_at":"2019-01-21T09:32:26Z","git_url":"git://github.com/moonming/ingress-nginx.git","ssh_url":"git@github.com:moonming/ingress-nginx.git","clone_url":"https://github.com/moonming/ingress-nginx.git","svn_url":"https://github.com/moonming/ingress-nginx","homepage":"https://kubernetes.github.io/ingress-nginx/","size":94442,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"42d3f68992862dfb2992b0ebc7ea82d041f7655b","user":{"login":"kubernetes","id":13629408,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNjI5NDA4","avatar_url":"https://avatars2.githubusercontent.com/u/13629408?v=4","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"repo":{"id":72891330,"node_id":"MDEwOlJlcG9zaXRvcnk3Mjg5MTMzMA==","name":"ingress-nginx","full_name":"kubernetes/ingress-nginx","private":false,"owner":{"login":"kubernetes","id":13629408,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNjI5NDA4","avatar_url":"https://avatars2.githubusercontent.com/u/13629408?v=4","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/kubernetes/ingress-nginx","description":"NGINX Ingress Controller for Kubernetes","fork":false,"url":"https://api.github.com/repos/kubernetes/ingress-nginx","forks_url":"https://api.github.com/repos/kubernetes/ingress-nginx/forks","keys_url":"https://api.github.com/repos/kubernetes/ingress-nginx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes/ingress-nginx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes/ingress-nginx/teams","hooks_url":"https://api.github.com/repos/kubernetes/ingress-nginx/hooks","issue_events_url":"https://api.github.com/repos/kubernetes/ingress-nginx/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes/ingress-nginx/events","assignees_url":"https://api.github.com/repos/kubernetes/ingress-nginx/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes/ingress-nginx/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes/ingress-nginx/tags","blobs_url":"https://api.github.com/repos/kubernetes/ingress-nginx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes/ingress-nginx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes/ingress-nginx/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes/ingress-nginx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes/ingress-nginx/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes/ingress-nginx/languages","stargazers_url":"https://api.github.com/repos/kubernetes/ingress-nginx/stargazers","contributors_url":"https://api.github.com/repos/kubernetes/ingress-nginx/contributors","subscribers_url":"https://api.github.com/repos/kubernetes/ingress-nginx/subscribers","subscription_url":"https://api.github.com/repos/kubernetes/ingress-nginx/subscription","commits_url":"https://api.github.com/repos/kubernetes/ingress-nginx/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes/ingress-nginx/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes/ingress-nginx/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes/ingress-nginx/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes/ingress-nginx/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes/ingress-nginx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes/ingress-nginx/merges","archive_url":"https://api.github.com/repos/kubernetes/ingress-nginx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes/ingress-nginx/downloads","issues_url":"https://api.github.com/repos/kubernetes/ingress-nginx/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes/ingress-nginx/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes/ingress-nginx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes/ingress-nginx/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes/ingress-nginx/releases{/id}","deployments_url":"https://api.github.com/repos/kubernetes/ingress-nginx/deployments","created_at":"2016-11-04T22:54:14Z","updated_at":"2019-02-10T10:27:08Z","pushed_at":"2019-02-09T22:26:25Z","git_url":"git://github.com/kubernetes/ingress-nginx.git","ssh_url":"git@github.com:kubernetes/ingress-nginx.git","clone_url":"https://github.com/kubernetes/ingress-nginx.git","svn_url":"https://github.com/kubernetes/ingress-nginx","homepage":"https://kubernetes.github.io/ingress-nginx/","size":105190,"stargazers_count":3905,"watchers_count":3905,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1909,"mirror_url":null,"archived":false,"open_issues_count":166,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":1909,"open_issues":166,"watchers":3905,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/3671"},"html":{"href":"https://github.com/kubernetes/ingress-nginx/pull/3671"},"issue":{"href":"https://api.github.com/repos/kubernetes/ingress-nginx/issues/3671"},"comments":{"href":"https://api.github.com/repos/kubernetes/ingress-nginx/issues/3671/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/3671/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/3671/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/ingress-nginx/statuses/8ea7501d8b4f14b748ef2c8d00e617ca16c43b9a"}},"author_association":"CONTRIBUTOR"}}
other: {"actor":{"display_login":"moonming"}}