0

When testing a ubuntu server running apache2 and mono 2.8.2 in a high load environment, about every ten minutes, it would output the following error (with the last two error lines repeated about a hundred times afterwards).

Handling exception type ArgumentOutOfRangeException
Message is Non-negative number required.
Parameter name: srcOffset
IsTerminating is set to True
System.ArgumentOutOfRangeException: Non-negative number required.
Parameter name: srcOffset
  at System.Buffer.BlockCopy (System.Array src, Int32 srcOffset, System.Array dst, Int32 dstOffset, Int32 count) [0x000b7] in /home/elliott/mono-2.8.2/mcs/class/corlib/System/Buffer.cs:103
  at System.Net.WebConnectionStream.ReadAll () [0x00183] in /home/elliott/mono-2.8.2/mcs/class/System/System.Net/WebConnectionStream.cs:259
  at System.Net.WebConnectionStream.CheckResponseInBuffer () [0x0002f] in /home/elliott/mono-2.8.2/mcs/class/System/System.Net/WebConnectionStream.cs:120
  at (wrapper remoting-invoke-with-check) System.Net.WebConnectionStream:CheckResponseInBuffer ()
  at System.Net.WebConnection.ReadDone (IAsyncResult result) [0x001a3] in /home/elliott/mono-2.8.2/mcs/class/System/System.Net/WebConnection.cs:476
  at System.Net.Sockets.Socket+SocketAsyncResult.CB (System.Object unused) [0x00000] in /home/elliott/mono-2.8.2/mcs/class/System/System.Net.Sockets/Socket.cs:214
[Tue Mar 08 13:49:58 2011] [error] (70014)End of file found: read_data failed
[Tue Mar 08 13:49:58 2011] [error] Command stream corrupted, last command was 1
[Tue Mar 08 13:49:58 2011] [error] (70014)End of file found: read_data failed
[Tue Mar 08 13:49:58 2011] [error] Command stream corrupted, last command was 1

Would this be an issue with something in my code somewhere, or is it a problem in mod_mono itself? It seemed to appear after putting a higher load on the server, and there were no reference line numbers to any of my source code files.

Also to note, after upgrading to mono 2.10.1, in small tests I instead get this error with every request (but I haven't been able to test any large scale load):

[Mon Mar 14 12:59:30 2011] [error] (70014)End of file found: read_data failed
[Mon Mar 14 12:59:30 2011] [error] Command stream corrupted, last command was -1
dben
  • 63
  • 4

2 Answers2

0

I may have fixed this some time ago in a git pull which got committed to Mono on 2012-03-01. Unfortunately, this means it isn't in mono 2.10.8.1 (which many distros are currently at since mono 3 is still beta).

justincc
  • 103
  • 2
  • 6
0

That looks like a bug in System.Net.WebConnectionStream.ReadAll to me. Somehow I suspect that readBufferOffset has become negative, although it's not obvious how... (of course, this may have been fixed since 2.8.2...) The argument validation code for Buffer.BlockCopy is pretty straightforward...

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
  • thanks. I was hoping that wasn't the case, but it looks like it could definitely be something in mono itself. Unfortunately variations of these errors show up in both mod_mono and mono-fastcgi for me, so I'll need to figure out how to work around them. – dben Mar 15 '11 at 15:15
  • In [`System.Net.WebConnection`](https://github.com/mono/mono/blob/2.8.2/mcs/class/System/System.Net/WebConnection.cs) on line 438, `pos` (offset) is set to -1 default, and then has several code paths (as unlikely as they may be, I don't know) where it does not change pos whatsoever. This error is fixed in 2.10.1, though. – dben Mar 15 '11 at 16:14
  • actually, my mistake, it's still an issue in 2.10.1 – dben Mar 15 '11 at 16:31