Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,11 @@ private Task ReadFromRowSourceAsync(CancellationToken cts)
}
else
{ // This will call Read for DataRows, DataTable and IDataReader (this includes all IDataReader except DbDataReader)
// Release lock to prevent possible deadlocks
SqlInternalConnectionTds internalConnection = _connection.GetOpenTdsConnection();
bool semaphoreLock = internalConnection._parserLock.CanBeReleasedFromAnyThread;
internalConnection._parserLock.Release();

_hasMoreRowToCopy = false;
try
{
Expand All @@ -1175,6 +1180,10 @@ private Task ReadFromRowSourceAsync(CancellationToken cts)
throw;
}
}
finally
{
internalConnection._parserLock.Wait(canReleaseFromAnyThread: semaphoreLock);
}
return null;
}
}
Expand Down
Loading