Fix rare deadlock in TestHost
This commit is contained in:
parent
a0de7564e2
commit
8451d1afcb
|
|
@ -352,6 +352,14 @@ namespace Microsoft.AspNetCore.TestHost
|
||||||
|
|
||||||
internal void Complete()
|
internal void Complete()
|
||||||
{
|
{
|
||||||
|
// If HttpClient.Dispose gets called while HttpClient.SetTask...() is called
|
||||||
|
// there is a chance that this method will be called twice and hang on the lock
|
||||||
|
// to prevent this we can check if there is already a thread inside the lock
|
||||||
|
if (_complete)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Prevent race with WaitForDataAsync
|
// Prevent race with WaitForDataAsync
|
||||||
lock (_signalReadLock)
|
lock (_signalReadLock)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue