WebResponse Stream mixup after Timeout !?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have two sequential threads that are accessing the same host using
WebRequest. The first WebRequest receives a "System.Net.WebException: The
operation has timed-out." The second request from the same host returns the
WebRequest.GetResponseStream() from the first WebRequest URI. This seems to
occur rarely (2 times in a week of several thousand requests), but regularly
(every week). What's going on??!?!

I'm not entirely convinced that the problem is related to threading. In one
case I've seen, the second WebRequest.GetResponse() doesn't begin until well
after the first thread has expired.

Using Compact Framework V1.0 SP3 on WM2003SE (on a Fujitsu-Seimens Loox 720).

If interested, I can point you to my application you can use to duplicate
this.

To email me, remove "elicacy" and "zier" from my email address.
 
Changing the ServicePointManager properties does seem to prevent a whole
bunch of WebRequests from the same ServicePoint from backing up behind two
WebRequests that are stuck. So I guess in a way that this suggestion got
around the problem by not having back-to-back requests to the same
ServicePoint. I still think the scenario points to a bug in the Compact
Framework related to maximum connections per ServicePoint.

In my scenario, the number of simultaneous connections is user configurable
and may theoretically be 1000, but practically will likely stay below 20-25.
There also may be a problem with this solution because the number of
simultaneous connections can be increased while connections already exist.

The other suggestion in the pointed to article talked about extracting the
response from the WebException and closing the response. This is good advice,
and I had already been following it.

OVerall a good article, and I learned about the ServicePoint stuff, too.
Thanks!

I'll have to continue to run my application to see if I see the Stream mixup
problem occurs again. I *am* still seeing "stuck" HttpWebRequest that never
return from GetResponse. But that is another, possibly unrelated problem.
 
Looks like I spoke too soon. It still seems to be failing the same way as
mentioned in the original post. Any other suggestions?
 
Back
Top