[Mono-list] HttpWebRequest.GetResponse() can trigger an uncatchable exception

Gonzalo Paniagua Javier gonzalo.mono at gmail.com
Sat Jul 9 11:50:34 EDT 2011

On Fri, Jul 8, 2011 at 10:47 AM, Christopher David Howie
<me at chrishowie.com> wrote:
> On 07/08/2011 10:43 AM, Gonzalo Paniagua Javier wrote:
>> Do you have a small test case that reproduces the problem?
> No, unfortunately.  This happens in maybe one out of a few thousand
> requests.  The only test case I can really come up with is "make lots of
> web requests on different threads until a crash happens."  I will poke
> around a bit and see if I can come up with a better repro, but it's just
> too intermittent to predict.  I suspect that it is dependent on a socket
> error to trigger.

Not much I can do without a test case.

I'd say that this is a problem reusing a connection and somehow 2
threads "own" the same stream. Set KeepAlive to false (and increase
the number of file descriptors! (ulimit)) and see if you can still
reproduce the problem. If it does not happen, bingo! Reduce the
'maxconnections' setting via app.config file to 1 and begin as many
requests as possible to the same URL. If you can reproduce it this
way, it's easier to find when 2 threads are using the same stream.

Also check the values of the variables involved in that BlockCopy call
and the values of readBuffer* before the call.


More information about the Mono-list mailing list