{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/azure-webjobs-sdk-script/issues/774","repository_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk-script","labels_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk-script/issues/774/labels{/name}","comments_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk-script/issues/774/comments","events_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk-script/issues/774/events","html_url":"https://github.com/Azure/azure-webjobs-sdk-script/issues/774","id":183816857,"number":774,"title":"Find a way to prevent people from writing synchronous C# code","user":{"login":"davidebbo","id":556238,"avatar_url":"https://avatars.githubusercontent.com/u/556238?v=3","gravatar_id":"","url":"https://api.github.com/users/davidebbo","html_url":"https://github.com/davidebbo","followers_url":"https://api.github.com/users/davidebbo/followers","following_url":"https://api.github.com/users/davidebbo/following{/other_user}","gists_url":"https://api.github.com/users/davidebbo/gists{/gist_id}","starred_url":"https://api.github.com/users/davidebbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidebbo/subscriptions","organizations_url":"https://api.github.com/users/davidebbo/orgs","repos_url":"https://api.github.com/users/davidebbo/repos","events_url":"https://api.github.com/users/davidebbo/events{/privacy}","received_events_url":"https://api.github.com/users/davidebbo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-18T22:13:05Z","updated_at":"2016-10-18T23:28:08Z","closed_at":null,"body":"We ran into a couple cases (one [here](https://social.msdn.microsoft.com/Forums/azure/en-US/5c142d90-adef-4d7b-8a30-3224b6229d93/app-could-be-having-an-intermediat-issue-or-failing-to-start?forum=AzureFunctions)) where user's apps deadlocked because they were making synchronous outgoing http calls, e.g.\r\n\r\n    HttpResponseMessage response = client.PostAsync(url , httpContent).Result;\r\n\r\nThat causes the thread to be blocked while waiting for the response. Once you throw enough traffic at it, all the threads are blocked, and there are none left to get scheduled and do the work, so you have a deadlock. See http://stackoverflow.com/questions/10343632/httpclient-getasync-never-returns-when-using-await-async.\r\n\r\n@lindydonna suggested that we could potentially use Roslyn's analyzer to detect the situation and treat it as an error. Though it's an aggressive move, we really want to make it very hard for people to do this."},"comment":{"url":"https://api.github.com/repos/Azure/azure-webjobs-sdk-script/issues/comments/254668500","html_url":"https://github.com/Azure/azure-webjobs-sdk-script/issues/774#issuecomment-254668500","issue_url":"https://api.github.com/repos/Azure/azure-webjobs-sdk-script/issues/774","id":254668500,"user":{"login":"fabiocav","id":2507935,"avatar_url":"https://avatars.githubusercontent.com/u/2507935?v=3","gravatar_id":"","url":"https://api.github.com/users/fabiocav","html_url":"https://github.com/fabiocav","followers_url":"https://api.github.com/users/fabiocav/followers","following_url":"https://api.github.com/users/fabiocav/following{/other_user}","gists_url":"https://api.github.com/users/fabiocav/gists{/gist_id}","starred_url":"https://api.github.com/users/fabiocav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabiocav/subscriptions","organizations_url":"https://api.github.com/users/fabiocav/orgs","repos_url":"https://api.github.com/users/fabiocav/repos","events_url":"https://api.github.com/users/fabiocav/events{/privacy}","received_events_url":"https://api.github.com/users/fabiocav/received_events","type":"User","site_admin":false},"created_at":"2016-10-18T23:28:08Z","updated_at":"2016-10-18T23:28:08Z","body":"Interesting. Would be good to investigate as we should not have a condition where we'd schedule continuations back on the request thread. The deadlock scenario is reproducible with a single request (no load required)"}}
{"actor":{"display_login":"fabiocav"}}