Bug 12280 - System.Threading.Tasks.Parallel.ForEach doesn't seem to work with Dapper (Mono.Data.Tds)
Summary: System.Threading.Tasks.Parallel.ForEach doesn't seem to work with Dapper (Mon...
Status: RESOLVED NORESPONSE
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Data ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-05-17 07:20 UTC by Andres G. Aragoneses
Modified: 2017-09-01 09:30 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NORESPONSE

Description Andres G. Aragoneses 2013-05-17 07:20:19 UTC
Mono version: today's master 872be6349ba30b573678e81276b2db2bb7f688a8 (3.0.11)

We're getting this exception when using System.Threading.Tasks.Parallel.ForEach to query a SQLServer database (in MS.NET it works fine):

Unhandled Exception:
System.AggregateException: One or more errors occured ---> System.IO.IOException: Read failure ---> System.Net.Sockets.SocketException: Connection reset by peer
  at System.Net.Sockets.Socket.Receive (System.Byte[] buffer, Int32 offset, Int32 size, SocketFlags flags) [0x0007e] in /home/lockerteam/mono/mcs/class/System/System.Net.Sockets/Socket.cs:1565 
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00067] in /home/lockerteam/mono/mcs/class/System/System.Net.Sockets/NetworkStream.cs:378 
  --- End of inner exception stack trace ---
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00078] in /home/lockerteam/mono/mcs/class/System/System.Net.Sockets/NetworkStream.cs:380 
  at Mono.Data.Tds.Protocol.TdsComm.Read (System.Byte[] buffer, Int32 offset, Int32 count) [0x00000] in /home/lockerteam/mono/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsComm.cs:611 
  --- End of inner exception stack trace ---
  at System.Threading.Tasks.Parallel.HandleExceptions (IEnumerable`1 tasks, System.Threading.Tasks.ExternalInfos infos) [0x0006e] in /home/lockerteam/mono/mcs/class/corlib/System.Threading.Tasks/Parallel.cs:79 
  at System.Threading.Tasks.Parallel.ForEach[TSource,TLocal] (System.Func`2 enumerable, System.Threading.Tasks.ParallelOptions options, System.Func`1 init, System.Func`4 action, System.Action`1 destruct) [0x00000] in <filename unknown>:0 
  at System.Threading.Tasks.Parallel.ForEach[TSource,TLocal] (System.Collections.Concurrent.Partitioner`1 source, System.Threading.Tasks.ParallelOptions parallelOptions, System.Func`1 localInit, System.Func`4 body, System.Action`1 localFinally) [0x00000] in <filename unknown>:0 
  at System.Threading.Tasks.Parallel.ForEach[TSource] (IEnumerable`1 source, System.Action`1 body) [0x00000] in <filename unknown>:0 
  at SevenDigital.Inbox.Backfill.Repositories.Cache.CacheFluffer.Fluff () [0x00014] in /home/lockerteam/sevendigital-inbox-backfill/src/SevenDigital.Inbox.Backfill/Repositories/Cache/CacheFluffer.cs:27 
  at SevenDigital.Inbox.Backfill.App.Program.RunBackfill (Int32 from, Int32 to, Int32 chunkSize) [0x0001c] in /home/lockerteam/sevendigital-inbox-backfill/src/SevenDigital.Inbox.Backfill.App/Program.cs:65 
  at SevenDigital.Inbox.Backfill.App.Program.Main (System.String[] args) [0x0009a] in /home/lockerteam/sevendigital-inbox-backfill/src/SevenDigital.Inbox.Backfill.App/Program.cs:53 
 --> (Inner exception 0) System.IO.IOException: Read failure ---> System.Net.Sockets.SocketException: Connection reset by peer
  at System.Net.Sockets.Socket.Receive (System.Byte[] buffer, Int32 offset, Int32 size, SocketFlags flags) [0x0007e] in /home/lockerteam/mono/mcs/class/System/System.Net.Sockets/Socket.cs:1565 
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00067] in /home/lockerteam/mono/mcs/class/System/System.Net.Sockets/NetworkStream.cs:378 
  --- End of inner exception stack trace ---
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00078] in /home/lockerteam/mono/mcs/class/System/System.Net.Sockets/NetworkStream.cs:380 
  at Mono.Data.Tds.Protocol.TdsComm.Read (System.Byte[] buffer, Int32 offset, Int32 count) [0x00000] in /home/lockerteam/mono/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsComm.cs:611 

 --> (Inner exception 1) System.IO.IOException: Read failure ---> System.Net.Sockets.SocketException: Connection reset by peer
  at System.Net.Sockets.Socket.Receive (System.Byte[] buffer, Int32 offset, Int32 size, SocketFlags flags) [0x0007e] in /home/lockerteam/mono/mcs/class/System/System.Net.Sockets/Socket.cs:1565 
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00067] in /home/lockerteam/mono/mcs/class/System/System.Net.Sockets/NetworkStream.cs:378 
  --- End of inner exception stack trace ---
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00078] in /home/lockerteam/mono/mcs/class/System/System.Net.Sockets/NetworkStream.cs:380 
  at Mono.Data.Tds.Protocol.TdsComm.Read (System.Byte[] buffer, Int32 offset, Int32 count) [0x00000] in /home/lockerteam/mono/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsComm.cs:611 

[ERROR] FATAL UNHANDLED EXCEPTION: System.AggregateException: One or more errors occured ---> System.IO.IOException: Read failure ---> System.Net.Sockets.SocketException: Connection reset by peer
  at System.Net.Sockets.Socket.Receive (System.Byte[] buffer, Int32 offset, Int32 size, SocketFlags flags) [0x0007e] in /home/lockerteam/mono/mcs/class/System/System.Net.Sockets/Socket.cs:1565 
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00067] in /home/lockerteam/mono/mcs/class/System/System.Net.Sockets/NetworkStream.cs:378 
  --- End of inner exception stack trace ---
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00078] in /home/lockerteam/mono/mcs/class/System/System.Net.Sockets/NetworkStream.cs:380 
  at Mono.Data.Tds.Protocol.TdsComm.Read (System.Byte[] buffer, Int32 offset, Int32 count) [0x00000] in /home/lockerteam/mono/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsComm.cs:611 
  --- End of inner exception stack trace ---
  at System.Threading.Tasks.Parallel.HandleExceptions (IEnumerable`1 tasks, System.Threading.Tasks.ExternalInfos infos) [0x0006e] in /home/lockerteam/mono/mcs/class/corlib/System.Threading.Tasks/Parallel.cs:79 
  at System.Threading.Tasks.Parallel.ForEach[TSource,TLocal] (System.Func`2 enumerable, System.Threading.Tasks.ParallelOptions options, System.Func`1 init, System.Func`4 action, System.Action`1 destruct) [0x00000] in <filename unknown>:0 
  at System.Threading.Tasks.Parallel.ForEach[TSource,TLocal] (System.Collections.Concurrent.Partitioner`1 source, System.Threading.Tasks.ParallelOptions parallelOptions, System.Func`1 localInit, System.Func`4 body, System.Action`1 localFinally) [0x00000] in <filename unknown>:0 
  at System.Threading.Tasks.Parallel.ForEach[TSource] (IEnumerable`1 source, System.Action`1 body) [0x00000] in <filename unknown>:0 
  at SevenDigital.Inbox.Backfill.Repositories.Cache.CacheFluffer.Fluff () [0x00014] in /home/lockerteam/sevendigital-inbox-backfill/src/SevenDigital.Inbox.Backfill/Repositories/Cache/CacheFluffer.cs:27 
  at SevenDigital.Inbox.Backfill.App.Program.RunBackfill (Int32 from, Int32 to, Int32 chunkSize) [0x0001c] in /home/lockerteam/sevendigital-inbox-backfill/src/SevenDigital.Inbox.Backfill.App/Program.cs:65 
  at SevenDigital.Inbox.Backfill.App.Program.Main (System.String[] args) [0x0009a] in /home/lockerteam/sevendigital-inbox-backfill/src/SevenDigital.Inbox.Backfill.App/Program.cs:53 
 --> (Inner exception 0) System.IO.IOException: Read failure ---> System.Net.Sockets.SocketException: Connection reset by peer
  at System.Net.Sockets.Socket.Receive (System.Byte[] buffer, Int32 offset, Int32 size, SocketFlags flags) [0x0007e] in /home/lockerteam/mono/mcs/class/System/System.Net.Sockets/Socket.cs:1565 
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00067] in /home/lockerteam/mono/mcs/class/System/System.Net.Sockets/NetworkStream.cs:378 
  --- End of inner exception stack trace ---
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00078] in /home/lockerteam/mono/mcs/class/System/System.Net.Sockets/NetworkStream.cs:380 
  at Mono.Data.Tds.Protocol.TdsComm.Read (System.Byte[] buffer, Int32 offset, Int32 count) [0x00000] in /home/lockerteam/mono/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsComm.cs:611 

 --> (Inner exception 1) System.IO.IOException: Read failure ---> System.Net.Sockets.SocketException: Connection reset by peer
  at System.Net.Sockets.Socket.Receive (System.Byte[] buffer, Int32 offset, Int32 size, SocketFlags flags) [0x0007e] in /home/lockerteam/mono/mcs/class/System/System.Net.Sockets/Socket.cs:1565 
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00067] in /home/lockerteam/mono/mcs/class/System/System.Net.Sockets/NetworkStream.cs:378 
  --- End of inner exception stack trace ---
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00078] in /home/lockerteam/mono/mcs/class/System/System.Net.Sockets/NetworkStream.cs:380 
  at Mono.Data.Tds.Protocol.TdsComm.Read (System.Byte[] buffer, Int32 offset, Int32 count) [0x00000] in /home/lockerteam/mono/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsComm.cs:611
Comment 1 Andres G. Aragoneses 2013-05-23 11:07:59 UTC
FYI, as soon as we removed Dapper from the mix, this started working.

I really don't have time to isolate the Dapper testcase for this mono bug (partly because I don't like Dapper anyway), so I'm going to close this.