{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/863","repository_url":"https://api.github.com/repos/aspnet/KestrelHttpServer","labels_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/863/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/863/comments","events_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/863/events","html_url":"https://github.com/aspnet/KestrelHttpServer/pull/863","id":156126107,"number":863,"title":"Fix the sync-completing async fast paths","user":{"login":"benaadams","id":1142958,"avatar_url":"https://avatars.githubusercontent.com/u/1142958?v=3","gravatar_id":"","url":"https://api.github.com/users/benaadams","html_url":"https://github.com/benaadams","followers_url":"https://api.github.com/users/benaadams/followers","following_url":"https://api.github.com/users/benaadams/following{/other_user}","gists_url":"https://api.github.com/users/benaadams/gists{/gist_id}","starred_url":"https://api.github.com/users/benaadams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benaadams/subscriptions","organizations_url":"https://api.github.com/users/benaadams/orgs","repos_url":"https://api.github.com/users/benaadams/repos","events_url":"https://api.github.com/users/benaadams/events{/privacy}","received_events_url":"https://api.github.com/users/benaadams/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aspnet/KestrelHttpServer/labels/cla-already-signed","name":"cla-already-signed","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-05-21T23:16:42Z","updated_at":"2016-05-22T04:26:20Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/863","html_url":"https://github.com/aspnet/KestrelHttpServer/pull/863","diff_url":"https://github.com/aspnet/KestrelHttpServer/pull/863.diff","patch_url":"https://github.com/aspnet/KestrelHttpServer/pull/863.patch"},"body":"ProduceStartAndFireOnStarting only goes async if the user has set an `OnStarting` task - which may also complete sync. \r\n\r\nIn normal circumstances `_onStarting != null` which means it returns a `CompletedTask` and doesn't need to go async or await.\r\n\r\nThe mechanism for fast-pathing this is already there, however its checking the wrong thing (whether a function needs to be called, rather than whether the task the function returns  `RanToCompletion`)\r\n\r\nThe red below shows the unnecessary call stack this creates (5% of WriteAsync):\r\n\r\n![too much await](http://aoa.blob.core.windows.net/aspnet/too-much-await-3.png)\r\n\r\nResolves  #864\r\n\r\n/cc @halter73 @cesarbs @davidfowl "},"comment":{"url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/comments/220813647","html_url":"https://github.com/aspnet/KestrelHttpServer/pull/863#issuecomment-220813647","issue_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/863","id":220813647,"user":{"login":"benaadams","id":1142958,"avatar_url":"https://avatars.githubusercontent.com/u/1142958?v=3","gravatar_id":"","url":"https://api.github.com/users/benaadams","html_url":"https://github.com/benaadams","followers_url":"https://api.github.com/users/benaadams/followers","following_url":"https://api.github.com/users/benaadams/following{/other_user}","gists_url":"https://api.github.com/users/benaadams/gists{/gist_id}","starred_url":"https://api.github.com/users/benaadams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benaadams/subscriptions","organizations_url":"https://api.github.com/users/benaadams/orgs","repos_url":"https://api.github.com/users/benaadams/repos","events_url":"https://api.github.com/users/benaadams/events{/privacy}","received_events_url":"https://api.github.com/users/benaadams/received_events","type":"User","site_admin":false},"created_at":"2016-05-22T04:26:20Z","updated_at":"2016-05-22T04:26:20Z","body":"Post changes the call chains are much reduced\r\n\r\n![post-await-fastpath](http://aoa.blob.core.windows.net/aspnet/awaiting-post.png)"}}
{"actor":{"display_login":"benaadams"}}