Skip to content
This repository was archived by the owner on Dec 19, 2018. It is now read-only.

Fixing deadlock hang in test when running in single threaded environment #523

Merged
merged 1 commit into from
Dec 14, 2015

Conversation

JunTaoLuo
Copy link
Contributor

Found the issue for #422. The test hangs because we are mixing async code in TestServer and blocking code in the test. This will cause a deadlock scenario but only when there is a single threaded scenario so it was undetected until now.

@@ -94,7 +94,7 @@ public ClientHandler(PathString pathBase, IHttpApplication<Context> application)
}
});

return await state.ResponseTask;
return await state.ResponseTask.ConfigureAwait(false);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though either the test change or the ConfigureAwait here will resolve the deadlock, it is suggested to do both here: http://blog.stephencleary.com/2012/07/dont-block-on-async-code.html

@Tratcher
Copy link
Member

:shipit:

@JunTaoLuo JunTaoLuo merged commit 455d865 into dev Dec 14, 2015
@JunTaoLuo JunTaoLuo deleted the johluo/deadlock-fix-test-hang branch December 14, 2015 18:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants