{"action":"created","comment":{"url":"https://api.github.com/repos/PowerDNS/pdns/pulls/comments/168140946","pull_request_review_id":96457617,"id":168140946,"diff_hunk":"@@ -194,8 +194,13 @@ void updateThread() {\n     }\n     time_t now = time(nullptr);\n     for (const auto &domain : g_domains) {\n-      if ((g_soas.find(domain) != g_soas.end() && now - lastCheck[domain] < g_soas[domain]->d_st.refresh) || // Only check if we have waited `refresh` seconds\n-          (g_soas.find(domain) == g_soas.end() && now - lastCheck[domain] < 30))  {                          // Or if we could not get an update at all still, every 30 seconds\n+      shared_ptr<SOARecordContent> current_soa;\n+      if (g_soas.find(domain) != g_soas.end()) {\n+        std::lock_guard<std::mutex> guard(g_soas_mutex);","path":"pdns/ixfrdist.cc","position":8,"original_position":8,"commit_id":"26ecdd799a87e130aab1b3a4859e974613d53e10","original_commit_id":"26ecdd799a87e130aab1b3a4859e974613d53e10","user":{"login":"rgacogne","id":1086257,"avatar_url":"https://avatars2.githubusercontent.com/u/1086257?v=4","gravatar_id":"","url":"https://api.github.com/users/rgacogne","html_url":"https://github.com/rgacogne","followers_url":"https://api.github.com/users/rgacogne/followers","following_url":"https://api.github.com/users/rgacogne/following{/other_user}","gists_url":"https://api.github.com/users/rgacogne/gists{/gist_id}","starred_url":"https://api.github.com/users/rgacogne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgacogne/subscriptions","organizations_url":"https://api.github.com/users/rgacogne/orgs","repos_url":"https://api.github.com/users/rgacogne/repos","events_url":"https://api.github.com/users/rgacogne/events{/privacy}","received_events_url":"https://api.github.com/users/rgacogne/received_events","type":"User","site_admin":false},"body":"`g_soas.find()` is still accessing the `map` without holding the lock. In that case it might be fine because we are in the `updateThread` thread which is the only one updating the `map`, but it might be an issue in the future.","created_at":"2018-02-14T11:01:19Z","updated_at":"2018-02-14T11:07:19Z","html_url":"https://github.com/PowerDNS/pdns/pull/6264#discussion_r168140946","pull_request_url":"https://api.github.com/repos/PowerDNS/pdns/pulls/6264","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/PowerDNS/pdns/pulls/comments/168140946"},"html":{"href":"https://github.com/PowerDNS/pdns/pull/6264#discussion_r168140946"},"pull_request":{"href":"https://api.github.com/repos/PowerDNS/pdns/pulls/6264"}}},"pull_request":{"url":"https://api.github.com/repos/PowerDNS/pdns/pulls/6264","id":169074925,"html_url":"https://github.com/PowerDNS/pdns/pull/6264","diff_url":"https://github.com/PowerDNS/pdns/pull/6264.diff","patch_url":"https://github.com/PowerDNS/pdns/pull/6264.patch","issue_url":"https://api.github.com/repos/PowerDNS/pdns/issues/6264","number":6264,"state":"open","locked":false,"title":"ixfrdist: Prevent a nullptr exception and guard reads/writes","user":{"login":"pieterlexis","id":731232,"avatar_url":"https://avatars2.githubusercontent.com/u/731232?v=4","gravatar_id":"","url":"https://api.github.com/users/pieterlexis","html_url":"https://github.com/pieterlexis","followers_url":"https://api.github.com/users/pieterlexis/followers","following_url":"https://api.github.com/users/pieterlexis/following{/other_user}","gists_url":"https://api.github.com/users/pieterlexis/gists{/gist_id}","starred_url":"https://api.github.com/users/pieterlexis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pieterlexis/subscriptions","organizations_url":"https://api.github.com/users/pieterlexis/orgs","repos_url":"https://api.github.com/users/pieterlexis/repos","events_url":"https://api.github.com/users/pieterlexis/events{/privacy}","received_events_url":"https://api.github.com/users/pieterlexis/received_events","type":"User","site_admin":false},"body":"### Short description\r\nIt was found that ixfrdist would crash with a segfault under certain circumstances. It seems that we would accidentally write a nullptr into `g_soas` on an update exception. This PR ensures we only write a SOA to g_soas when an update is fully done.\r\n\r\nAlso, protect every read access to `g_soas` with the mutex.\r\n\r\n### Checklist\r\n<!-- please indicate if any of these things are done/included with this Pull Request. Not all boxes need to be checked for the Pull Request to be accepted -->\r\nI have:\r\n- [x] read the [CONTRIBUTING.md](https://github.com/PowerDNS/pdns/blob/master/CONTRIBUTING.md) document\r\n- [ ] compiled and tested this code\r\n- [ ] included documentation (including possible behaviour changes)\r\n- [ ] documented the code\r\n- [ ] added or modified regression test(s)\r\n- [ ] added or modified unit test(s)\r\n- [ ] <!-- remove this line if your PR is against master --> checked that this code was merged to master\r\n","created_at":"2018-02-14T10:42:00Z","updated_at":"2018-02-14T11:07:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"823e0dd709a1b224d119bba588dca0f0a28a2df9","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/PowerDNS/pdns/pulls/6264/commits","review_comments_url":"https://api.github.com/repos/PowerDNS/pdns/pulls/6264/comments","review_comment_url":"https://api.github.com/repos/PowerDNS/pdns/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PowerDNS/pdns/issues/6264/comments","statuses_url":"https://api.github.com/repos/PowerDNS/pdns/statuses/26ecdd799a87e130aab1b3a4859e974613d53e10","head":{"label":"pieterlexis:ixfrdist-nullptr","ref":"ixfrdist-nullptr","sha":"26ecdd799a87e130aab1b3a4859e974613d53e10","user":{"login":"pieterlexis","id":731232,"avatar_url":"https://avatars2.githubusercontent.com/u/731232?v=4","gravatar_id":"","url":"https://api.github.com/users/pieterlexis","html_url":"https://github.com/pieterlexis","followers_url":"https://api.github.com/users/pieterlexis/followers","following_url":"https://api.github.com/users/pieterlexis/following{/other_user}","gists_url":"https://api.github.com/users/pieterlexis/gists{/gist_id}","starred_url":"https://api.github.com/users/pieterlexis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pieterlexis/subscriptions","organizations_url":"https://api.github.com/users/pieterlexis/orgs","repos_url":"https://api.github.com/users/pieterlexis/repos","events_url":"https://api.github.com/users/pieterlexis/events{/privacy}","received_events_url":"https://api.github.com/users/pieterlexis/received_events","type":"User","site_admin":false},"repo":{"id":22097190,"name":"pdns","full_name":"pieterlexis/pdns","owner":{"login":"pieterlexis","id":731232,"avatar_url":"https://avatars2.githubusercontent.com/u/731232?v=4","gravatar_id":"","url":"https://api.github.com/users/pieterlexis","html_url":"https://github.com/pieterlexis","followers_url":"https://api.github.com/users/pieterlexis/followers","following_url":"https://api.github.com/users/pieterlexis/following{/other_user}","gists_url":"https://api.github.com/users/pieterlexis/gists{/gist_id}","starred_url":"https://api.github.com/users/pieterlexis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pieterlexis/subscriptions","organizations_url":"https://api.github.com/users/pieterlexis/orgs","repos_url":"https://api.github.com/users/pieterlexis/repos","events_url":"https://api.github.com/users/pieterlexis/events{/privacy}","received_events_url":"https://api.github.com/users/pieterlexis/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pieterlexis/pdns","description":"PowerDNS","fork":true,"url":"https://api.github.com/repos/pieterlexis/pdns","forks_url":"https://api.github.com/repos/pieterlexis/pdns/forks","keys_url":"https://api.github.com/repos/pieterlexis/pdns/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pieterlexis/pdns/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pieterlexis/pdns/teams","hooks_url":"https://api.github.com/repos/pieterlexis/pdns/hooks","issue_events_url":"https://api.github.com/repos/pieterlexis/pdns/issues/events{/number}","events_url":"https://api.github.com/repos/pieterlexis/pdns/events","assignees_url":"https://api.github.com/repos/pieterlexis/pdns/assignees{/user}","branches_url":"https://api.github.com/repos/pieterlexis/pdns/branches{/branch}","tags_url":"https://api.github.com/repos/pieterlexis/pdns/tags","blobs_url":"https://api.github.com/repos/pieterlexis/pdns/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pieterlexis/pdns/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pieterlexis/pdns/git/refs{/sha}","trees_url":"https://api.github.com/repos/pieterlexis/pdns/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pieterlexis/pdns/statuses/{sha}","languages_url":"https://api.github.com/repos/pieterlexis/pdns/languages","stargazers_url":"https://api.github.com/repos/pieterlexis/pdns/stargazers","contributors_url":"https://api.github.com/repos/pieterlexis/pdns/contributors","subscribers_url":"https://api.github.com/repos/pieterlexis/pdns/subscribers","subscription_url":"https://api.github.com/repos/pieterlexis/pdns/subscription","commits_url":"https://api.github.com/repos/pieterlexis/pdns/commits{/sha}","git_commits_url":"https://api.github.com/repos/pieterlexis/pdns/git/commits{/sha}","comments_url":"https://api.github.com/repos/pieterlexis/pdns/comments{/number}","issue_comment_url":"https://api.github.com/repos/pieterlexis/pdns/issues/comments{/number}","contents_url":"https://api.github.com/repos/pieterlexis/pdns/contents/{+path}","compare_url":"https://api.github.com/repos/pieterlexis/pdns/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pieterlexis/pdns/merges","archive_url":"https://api.github.com/repos/pieterlexis/pdns/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pieterlexis/pdns/downloads","issues_url":"https://api.github.com/repos/pieterlexis/pdns/issues{/number}","pulls_url":"https://api.github.com/repos/pieterlexis/pdns/pulls{/number}","milestones_url":"https://api.github.com/repos/pieterlexis/pdns/milestones{/number}","notifications_url":"https://api.github.com/repos/pieterlexis/pdns/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pieterlexis/pdns/labels{/name}","releases_url":"https://api.github.com/repos/pieterlexis/pdns/releases{/id}","deployments_url":"https://api.github.com/repos/pieterlexis/pdns/deployments","created_at":"2014-07-22T08:52:10Z","updated_at":"2016-02-24T14:29:33Z","pushed_at":"2018-02-14T10:41:39Z","git_url":"git://github.com/pieterlexis/pdns.git","ssh_url":"git@github.com:pieterlexis/pdns.git","clone_url":"https://github.com/pieterlexis/pdns.git","svn_url":"https://github.com/pieterlexis/pdns","homepage":null,"size":48057,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0"},"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"PowerDNS:master","ref":"master","sha":"209955c729337c73994931004aedbc0f90cb2dab","user":{"login":"PowerDNS","id":1282630,"avatar_url":"https://avatars3.githubusercontent.com/u/1282630?v=4","gravatar_id":"","url":"https://api.github.com/users/PowerDNS","html_url":"https://github.com/PowerDNS","followers_url":"https://api.github.com/users/PowerDNS/followers","following_url":"https://api.github.com/users/PowerDNS/following{/other_user}","gists_url":"https://api.github.com/users/PowerDNS/gists{/gist_id}","starred_url":"https://api.github.com/users/PowerDNS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PowerDNS/subscriptions","organizations_url":"https://api.github.com/users/PowerDNS/orgs","repos_url":"https://api.github.com/users/PowerDNS/repos","events_url":"https://api.github.com/users/PowerDNS/events{/privacy}","received_events_url":"https://api.github.com/users/PowerDNS/received_events","type":"Organization","site_admin":false},"repo":{"id":9693534,"name":"pdns","full_name":"PowerDNS/pdns","owner":{"login":"PowerDNS","id":1282630,"avatar_url":"https://avatars3.githubusercontent.com/u/1282630?v=4","gravatar_id":"","url":"https://api.github.com/users/PowerDNS","html_url":"https://github.com/PowerDNS","followers_url":"https://api.github.com/users/PowerDNS/followers","following_url":"https://api.github.com/users/PowerDNS/following{/other_user}","gists_url":"https://api.github.com/users/PowerDNS/gists{/gist_id}","starred_url":"https://api.github.com/users/PowerDNS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PowerDNS/subscriptions","organizations_url":"https://api.github.com/users/PowerDNS/orgs","repos_url":"https://api.github.com/users/PowerDNS/repos","events_url":"https://api.github.com/users/PowerDNS/events{/privacy}","received_events_url":"https://api.github.com/users/PowerDNS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PowerDNS/pdns","description":"PowerDNS","fork":false,"url":"https://api.github.com/repos/PowerDNS/pdns","forks_url":"https://api.github.com/repos/PowerDNS/pdns/forks","keys_url":"https://api.github.com/repos/PowerDNS/pdns/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PowerDNS/pdns/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PowerDNS/pdns/teams","hooks_url":"https://api.github.com/repos/PowerDNS/pdns/hooks","issue_events_url":"https://api.github.com/repos/PowerDNS/pdns/issues/events{/number}","events_url":"https://api.github.com/repos/PowerDNS/pdns/events","assignees_url":"https://api.github.com/repos/PowerDNS/pdns/assignees{/user}","branches_url":"https://api.github.com/repos/PowerDNS/pdns/branches{/branch}","tags_url":"https://api.github.com/repos/PowerDNS/pdns/tags","blobs_url":"https://api.github.com/repos/PowerDNS/pdns/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PowerDNS/pdns/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PowerDNS/pdns/git/refs{/sha}","trees_url":"https://api.github.com/repos/PowerDNS/pdns/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PowerDNS/pdns/statuses/{sha}","languages_url":"https://api.github.com/repos/PowerDNS/pdns/languages","stargazers_url":"https://api.github.com/repos/PowerDNS/pdns/stargazers","contributors_url":"https://api.github.com/repos/PowerDNS/pdns/contributors","subscribers_url":"https://api.github.com/repos/PowerDNS/pdns/subscribers","subscription_url":"https://api.github.com/repos/PowerDNS/pdns/subscription","commits_url":"https://api.github.com/repos/PowerDNS/pdns/commits{/sha}","git_commits_url":"https://api.github.com/repos/PowerDNS/pdns/git/commits{/sha}","comments_url":"https://api.github.com/repos/PowerDNS/pdns/comments{/number}","issue_comment_url":"https://api.github.com/repos/PowerDNS/pdns/issues/comments{/number}","contents_url":"https://api.github.com/repos/PowerDNS/pdns/contents/{+path}","compare_url":"https://api.github.com/repos/PowerDNS/pdns/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PowerDNS/pdns/merges","archive_url":"https://api.github.com/repos/PowerDNS/pdns/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PowerDNS/pdns/downloads","issues_url":"https://api.github.com/repos/PowerDNS/pdns/issues{/number}","pulls_url":"https://api.github.com/repos/PowerDNS/pdns/pulls{/number}","milestones_url":"https://api.github.com/repos/PowerDNS/pdns/milestones{/number}","notifications_url":"https://api.github.com/repos/PowerDNS/pdns/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PowerDNS/pdns/labels{/name}","releases_url":"https://api.github.com/repos/PowerDNS/pdns/releases{/id}","deployments_url":"https://api.github.com/repos/PowerDNS/pdns/deployments","created_at":"2013-04-26T11:16:49Z","updated_at":"2018-02-13T07:50:14Z","pushed_at":"2018-02-14T10:42:00Z","git_url":"git://github.com/PowerDNS/pdns.git","ssh_url":"git@github.com:PowerDNS/pdns.git","clone_url":"https://github.com/PowerDNS/pdns.git","svn_url":"https://github.com/PowerDNS/pdns","homepage":null,"size":41095,"stargazers_count":1142,"watchers_count":1142,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":400,"mirror_url":null,"archived":false,"open_issues_count":590,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0"},"forks":400,"open_issues":590,"watchers":1142,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PowerDNS/pdns/pulls/6264"},"html":{"href":"https://github.com/PowerDNS/pdns/pull/6264"},"issue":{"href":"https://api.github.com/repos/PowerDNS/pdns/issues/6264"},"comments":{"href":"https://api.github.com/repos/PowerDNS/pdns/issues/6264/comments"},"review_comments":{"href":"https://api.github.com/repos/PowerDNS/pdns/pulls/6264/comments"},"review_comment":{"href":"https://api.github.com/repos/PowerDNS/pdns/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PowerDNS/pdns/pulls/6264/commits"},"statuses":{"href":"https://api.github.com/repos/PowerDNS/pdns/statuses/26ecdd799a87e130aab1b3a4859e974613d53e10"}},"author_association":"OWNER"}}
{"actor":{"display_login":"rgacogne"}}