WebRequest.Timeout bugs?

From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 08/23/04


Date: Mon, 23 Aug 2004 15:27:11 +0100

I'm trying to understand why our mobile client isn't behaving
gracefully with a "hung" server. The server is accepting web requests,
but then not responding to them. Obviously we're working on that side
of the problem too, but we thought that by putting a timeout on the
WebRequest, and backing off in the same was as we do for other errors,
that we'd have a robust system. Apparently we don't.

I'm being absolutely rigorous in cleaning up - not only am I calling
Close() on every WebResponse received (including those embedded in
WebExceptions) but I'm also closing the ResponseStream - hopefully
unnecessarily.

The situation is slightly complicated by the server being hung in such
a way that the first request is rejected (correctly) with a 401
response due to the way our authentication works. (The first request
for any client is a 401 with a nonce to use for future authentication.)

The first request works fine with a suitably high timeout, although it
*does* time out if the timeout is set very low.

The second request (which the server actually hangs on) never seems to
time out.

It's as if the timeout only applies from the start of the call
(WebRequest.GetResponse) to the time at which the connection is
actually made.

Does anyone have any idea what's going on, and how to fix it?

-- 
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Relevant Pages

  • Re: how to handle socket timeout?
    ... The notion of "fast" is configurable by the timeout value. ... The server became unreachable. ... TCP is a reliable bytestream protocol based on ... etc), send a request using UDP when you want to request some data, ...
    (comp.unix.programmer)
  • Re: Timeout problems
    ... I am assuming that the time out is a scripting timeout on your browser. ... we have a request to the SQL Server ... database to run a stored procedure to return the data. ...
    (microsoft.public.dotnet.general)
  • Re: How can I turn off NetBIOS Nameserver Responses once theyve start
    ... > IANA but that is because it is an autoconfiguration IP address. ... > responding to a name server request from the "IANA box". ...
    (microsoft.public.win2000.networking)
  • Re: ASPX pages failing when SQL Server busy
    ... "Error: System.Data.SqlClient.SqlException: Timeout expired. ... server is not responding." ... same server, and same instance). ... The problems seem to appear just before the sproc ...
    (microsoft.public.sqlserver.server)
  • Re: ASPX pages failing when SQL Server busy
    ... "Error: System.Data.SqlClient.SqlException: Timeout expired. ... server is not responding." ... same server, and same instance). ... The problems seem to appear just before the sproc ...
    (microsoft.public.sqlserver.programming)

Quantcast