File tree Expand file tree Collapse file tree 2 files changed +57
-39
lines changed
src/Microsoft.Data.SqlClient
netcore/src/Microsoft/Data/SqlClient
netfx/src/Microsoft/Data/SqlClient Expand file tree Collapse file tree 2 files changed +57
-39
lines changed Original file line number Diff line number Diff line change @@ -1159,6 +1159,11 @@ private Task ReadFromRowSourceAsync(CancellationToken cts)
1159
1159
}
1160
1160
else
1161
1161
{ // This will call Read for DataRows, DataTable and IDataReader (this includes all IDataReader except DbDataReader)
1162
+ // Release lock to prevent possible deadlocks
1163
+ SqlInternalConnectionTds internalConnection = _connection . GetOpenTdsConnection ( ) ;
1164
+ bool semaphoreLock = internalConnection . _parserLock . CanBeReleasedFromAnyThread ;
1165
+ internalConnection . _parserLock . Release ( ) ;
1166
+
1162
1167
_hasMoreRowToCopy = false ;
1163
1168
try
1164
1169
{
@@ -1175,6 +1180,10 @@ private Task ReadFromRowSourceAsync(CancellationToken cts)
1175
1180
throw ;
1176
1181
}
1177
1182
}
1183
+ finally
1184
+ {
1185
+ internalConnection . _parserLock . Wait ( canReleaseFromAnyThread : semaphoreLock ) ;
1186
+ }
1178
1187
return null ;
1179
1188
}
1180
1189
}
You can’t perform that action at this time.
0 commit comments