{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/roslyn/pulls/comments/30453933","id":30453933,"diff_hunk":"@@ -249,7 +249,7 @@ internal NamespaceOrTypeSymbol GetAliasTarget(ConsList<Symbol> basesBeingResolve\n \n                 if ((object)Interlocked.CompareExchange(ref _aliasTarget, symbol, null) == null)\n                 {\n-                    bool won = ImmutableInterlocked.InterlockedInitialize(ref _aliasTargetDiagnostics, newDiagnostics.ToReadOnlyAndFree());\n+                    bool won = Interlocked.Exchange(ref _aliasTargetDiagnostics, newDiagnostics) == null;\n                     Debug.Assert(won, \"Only one thread can win the alias target CompareExchange\");\n ","path":"src/Compilers/CSharp/Portable/Symbols/AliasSymbol.cs","position":16,"original_position":16,"commit_id":"01d56f825e4e20b7fd09f4b0de67285644763075","original_commit_id":"01d56f825e4e20b7fd09f4b0de67285644763075","user":{"login":"VSadov","id":8218165,"avatar_url":"https://avatars.githubusercontent.com/u/8218165?v=3","gravatar_id":"","url":"https://api.github.com/users/VSadov","html_url":"https://github.com/VSadov","followers_url":"https://api.github.com/users/VSadov/followers","following_url":"https://api.github.com/users/VSadov/following{/other_user}","gists_url":"https://api.github.com/users/VSadov/gists{/gist_id}","starred_url":"https://api.github.com/users/VSadov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VSadov/subscriptions","organizations_url":"https://api.github.com/users/VSadov/orgs","repos_url":"https://api.github.com/users/VSadov/repos","events_url":"https://api.github.com/users/VSadov/events{/privacy}","received_events_url":"https://api.github.com/users/VSadov/received_events","type":"User","site_admin":false},"body":"This Assert seems to check that CompareExchange works as expected. \r\nPerhaps the whole thing should be just \" _aliasTargetDiagnostics = newDiagnostics \"","created_at":"2015-05-15T23:29:17Z","updated_at":"2015-05-15T23:29:17Z","html_url":"https://github.com/dotnet/roslyn/pull/2813#discussion_r30453933","pull_request_url":"https://api.github.com/repos/dotnet/roslyn/pulls/2813","_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/comments/30453933"},"html":{"href":"https://github.com/dotnet/roslyn/pull/2813#discussion_r30453933"},"pull_request":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/2813"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/roslyn/pulls/2813","id":35558654,"html_url":"https://github.com/dotnet/roslyn/pull/2813","diff_url":"https://github.com/dotnet/roslyn/pull/2813.diff","patch_url":"https://github.com/dotnet/roslyn/pull/2813.patch","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/2813","number":2813,"state":"open","locked":false,"title":"Fix deadlock in AliasSymbol.GetAliasTarget","user":{"login":"jaredpar","id":146967,"avatar_url":"https://avatars.githubusercontent.com/u/146967?v=3","gravatar_id":"","url":"https://api.github.com/users/jaredpar","html_url":"https://github.com/jaredpar","followers_url":"https://api.github.com/users/jaredpar/followers","following_url":"https://api.github.com/users/jaredpar/following{/other_user}","gists_url":"https://api.github.com/users/jaredpar/gists{/gist_id}","starred_url":"https://api.github.com/users/jaredpar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaredpar/subscriptions","organizations_url":"https://api.github.com/users/jaredpar/orgs","repos_url":"https://api.github.com/users/jaredpar/repos","events_url":"https://api.github.com/users/jaredpar/events{/privacy}","received_events_url":"https://api.github.com/users/jaredpar/received_events","type":"User","site_admin":false},"body":"The following line inside GetAliasTarget was causing a deadlock in the\r\ncompiler:\r\n\r\n```\r\nbool won = ImmutableInterlocked.InterlockedInitialize(ref\r\n_aliasTargetDiagnostics, newDiagnostics.ToReadOnlyAndFree());\r\n```\r\n\r\nThe ToReadOnlyAndFree call caused any lazy diagnostics present in the\r\nDiagnosticsBag to be promptly evaluated.  As a part of evaluation the\r\ndiagnostics could call back into other compiler code including\r\nAliasSymbol.GetAliasTarget.  If that happened on the same AliasSymbol\r\ninstance the compiler would enter a deadlock as _aliasTarget had already\r\nbeen set to a non-null value.\r\n\r\nThe CompareExchange of _aliasTarget is effectively a lock statement\r\nToReadOnlyAndFree is calling out to untrusted code.  The fix is to stop\r\ndoing this by just saving the DiagnosticBag directly vs. calling\r\nToReadOnlyAndFree.\r\n\r\nThis resolves DevDiv 1161400","created_at":"2015-05-15T23:11:03Z","updated_at":"2015-05-15T23:29:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"efd3f7b800970a3f539dbebf1357b3989e44ecd3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/roslyn/pulls/2813/commits","review_comments_url":"https://api.github.com/repos/dotnet/roslyn/pulls/2813/comments","review_comment_url":"https://api.github.com/repos/dotnet/roslyn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/2813/comments","statuses_url":"https://api.github.com/repos/dotnet/roslyn/statuses/01d56f825e4e20b7fd09f4b0de67285644763075","head":{"label":"jaredpar:deadlock","ref":"deadlock","sha":"01d56f825e4e20b7fd09f4b0de67285644763075","user":{"login":"jaredpar","id":146967,"avatar_url":"https://avatars.githubusercontent.com/u/146967?v=3","gravatar_id":"","url":"https://api.github.com/users/jaredpar","html_url":"https://github.com/jaredpar","followers_url":"https://api.github.com/users/jaredpar/followers","following_url":"https://api.github.com/users/jaredpar/following{/other_user}","gists_url":"https://api.github.com/users/jaredpar/gists{/gist_id}","starred_url":"https://api.github.com/users/jaredpar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaredpar/subscriptions","organizations_url":"https://api.github.com/users/jaredpar/orgs","repos_url":"https://api.github.com/users/jaredpar/repos","events_url":"https://api.github.com/users/jaredpar/events{/privacy}","received_events_url":"https://api.github.com/users/jaredpar/received_events","type":"User","site_admin":false},"repo":{"id":29310774,"name":"roslyn","full_name":"jaredpar/roslyn","owner":{"login":"jaredpar","id":146967,"avatar_url":"https://avatars.githubusercontent.com/u/146967?v=3","gravatar_id":"","url":"https://api.github.com/users/jaredpar","html_url":"https://github.com/jaredpar","followers_url":"https://api.github.com/users/jaredpar/followers","following_url":"https://api.github.com/users/jaredpar/following{/other_user}","gists_url":"https://api.github.com/users/jaredpar/gists{/gist_id}","starred_url":"https://api.github.com/users/jaredpar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaredpar/subscriptions","organizations_url":"https://api.github.com/users/jaredpar/orgs","repos_url":"https://api.github.com/users/jaredpar/repos","events_url":"https://api.github.com/users/jaredpar/events{/privacy}","received_events_url":"https://api.github.com/users/jaredpar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jaredpar/roslyn","description":"The .NET Compiler Platform (\"Roslyn\") provides open-source C# and Visual Basic compilers with rich code analysis APIs.","fork":true,"url":"https://api.github.com/repos/jaredpar/roslyn","forks_url":"https://api.github.com/repos/jaredpar/roslyn/forks","keys_url":"https://api.github.com/repos/jaredpar/roslyn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jaredpar/roslyn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jaredpar/roslyn/teams","hooks_url":"https://api.github.com/repos/jaredpar/roslyn/hooks","issue_events_url":"https://api.github.com/repos/jaredpar/roslyn/issues/events{/number}","events_url":"https://api.github.com/repos/jaredpar/roslyn/events","assignees_url":"https://api.github.com/repos/jaredpar/roslyn/assignees{/user}","branches_url":"https://api.github.com/repos/jaredpar/roslyn/branches{/branch}","tags_url":"https://api.github.com/repos/jaredpar/roslyn/tags","blobs_url":"https://api.github.com/repos/jaredpar/roslyn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jaredpar/roslyn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jaredpar/roslyn/git/refs{/sha}","trees_url":"https://api.github.com/repos/jaredpar/roslyn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jaredpar/roslyn/statuses/{sha}","languages_url":"https://api.github.com/repos/jaredpar/roslyn/languages","stargazers_url":"https://api.github.com/repos/jaredpar/roslyn/stargazers","contributors_url":"https://api.github.com/repos/jaredpar/roslyn/contributors","subscribers_url":"https://api.github.com/repos/jaredpar/roslyn/subscribers","subscription_url":"https://api.github.com/repos/jaredpar/roslyn/subscription","commits_url":"https://api.github.com/repos/jaredpar/roslyn/commits{/sha}","git_commits_url":"https://api.github.com/repos/jaredpar/roslyn/git/commits{/sha}","comments_url":"https://api.github.com/repos/jaredpar/roslyn/comments{/number}","issue_comment_url":"https://api.github.com/repos/jaredpar/roslyn/issues/comments{/number}","contents_url":"https://api.github.com/repos/jaredpar/roslyn/contents/{+path}","compare_url":"https://api.github.com/repos/jaredpar/roslyn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jaredpar/roslyn/merges","archive_url":"https://api.github.com/repos/jaredpar/roslyn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jaredpar/roslyn/downloads","issues_url":"https://api.github.com/repos/jaredpar/roslyn/issues{/number}","pulls_url":"https://api.github.com/repos/jaredpar/roslyn/pulls{/number}","milestones_url":"https://api.github.com/repos/jaredpar/roslyn/milestones{/number}","notifications_url":"https://api.github.com/repos/jaredpar/roslyn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jaredpar/roslyn/labels{/name}","releases_url":"https://api.github.com/repos/jaredpar/roslyn/releases{/id}","created_at":"2015-01-15T18:10:36Z","updated_at":"2015-03-26T17:29:26Z","pushed_at":"2015-05-15T23:10:47Z","git_url":"git://github.com/jaredpar/roslyn.git","ssh_url":"git@github.com:jaredpar/roslyn.git","clone_url":"https://github.com/jaredpar/roslyn.git","svn_url":"https://github.com/jaredpar/roslyn","homepage":"","size":75117,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"00a5919246fd4fd6be87521c947302c67c8d297b","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":29078997,"name":"roslyn","full_name":"dotnet/roslyn","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/roslyn","description":"The .NET Compiler Platform (\"Roslyn\") provides open-source C# and Visual Basic compilers with rich code analysis APIs.","fork":false,"url":"https://api.github.com/repos/dotnet/roslyn","forks_url":"https://api.github.com/repos/dotnet/roslyn/forks","keys_url":"https://api.github.com/repos/dotnet/roslyn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/roslyn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/roslyn/teams","hooks_url":"https://api.github.com/repos/dotnet/roslyn/hooks","issue_events_url":"https://api.github.com/repos/dotnet/roslyn/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/roslyn/events","assignees_url":"https://api.github.com/repos/dotnet/roslyn/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/roslyn/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/roslyn/tags","blobs_url":"https://api.github.com/repos/dotnet/roslyn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/roslyn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/roslyn/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/roslyn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/roslyn/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/roslyn/languages","stargazers_url":"https://api.github.com/repos/dotnet/roslyn/stargazers","contributors_url":"https://api.github.com/repos/dotnet/roslyn/contributors","subscribers_url":"https://api.github.com/repos/dotnet/roslyn/subscribers","subscription_url":"https://api.github.com/repos/dotnet/roslyn/subscription","commits_url":"https://api.github.com/repos/dotnet/roslyn/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/roslyn/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/roslyn/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/roslyn/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/roslyn/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/roslyn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/roslyn/merges","archive_url":"https://api.github.com/repos/dotnet/roslyn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/roslyn/downloads","issues_url":"https://api.github.com/repos/dotnet/roslyn/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/roslyn/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/roslyn/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/roslyn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/roslyn/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/roslyn/releases{/id}","created_at":"2015-01-11T02:39:03Z","updated_at":"2015-05-15T15:54:48Z","pushed_at":"2015-05-15T23:29:16Z","git_url":"git://github.com/dotnet/roslyn.git","ssh_url":"git@github.com:dotnet/roslyn.git","clone_url":"https://github.com/dotnet/roslyn.git","svn_url":"https://github.com/dotnet/roslyn","homepage":"","size":132440,"stargazers_count":2301,"watchers_count":2301,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":488,"mirror_url":null,"open_issues_count":837,"forks":488,"open_issues":837,"watchers":2301,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/2813"},"html":{"href":"https://github.com/dotnet/roslyn/pull/2813"},"issue":{"href":"https://api.github.com/repos/dotnet/roslyn/issues/2813"},"comments":{"href":"https://api.github.com/repos/dotnet/roslyn/issues/2813/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/2813/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/2813/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/roslyn/statuses/01d56f825e4e20b7fd09f4b0de67285644763075"}}}}