Troubleshoot IOException on IAsyncResult and HTTPS

  • Thread starter Martijn van Schie
  • Start date
M

Martijn van Schie

Hi,

I have a issue where is ever so often get an IOException:

Type : System.IO.IOException, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
Message : Unable to read data from the transport connection: The connection
was closed.
Source : System
Help link :
Data : System.Collections.ListDictionaryInternal
TargetSite : System.IAsyncResult InternalWrite(Boolean, Byte[], Int32,
Int32, System.AsyncCallback, System.Object)

We are creating the request custom using the HttpWebRequest object and
execute the using the Page.RegisterAsyncTask.

HttpWebRequest request =
(HttpWebRequest)WebRequest.Create(_navigationUri);

byte[] requestBytes =
System.Text.Encoding.ASCII.GetBytes(authenticateMessage);

request.Method = "POST";
request.ContentType = "text/xml; charset=\"utf-8\"";
request.ContentLength = requestBytes.Length;

combinedAsyncState.ProxyState = new object[] { request,
requestBytes };
return request.BeginGetRequestStream(callback, state);

The error occures only once every 10 minutes during a webtest. The trouble
is that this is very hard to debug because i cannot reproduce the error when
i want.
The party claims they have no error, nor are they responsible for the error.
Putting something like Fiddler in between to catch the request and response
message is also no option, because the requests are over HTTPS.

What is the best opproach to tackle this issue.
Regards,
Martijn
 
J

John Saunders [MVP]

Martijn van Schie said:
Hi,

I have a issue where is ever so often get an IOException: ....
The error occures only once every 10 minutes during a webtest. The trouble
is that this is very hard to debug because i cannot reproduce the error
when i want.
The party claims they have no error, nor are they responsible for the
error.
Putting something like Fiddler in between to catch the request and
response message is also no option, because the requests are over HTTPS.

What is the best opproach to tackle this issue.

Can you try to reproduce it with HTTP?

Also, please post the entire exception, including the InnerException and
stack traces.
 
M

Martijn van Schie

Hi John,

It's hard for me to reproduce it using HTTP, because we are using a test
WebService from a third party authorisation service.

The entire stacktrace comes to this:

Stack Trace :
at System.Net.ConnectStream.InternalWrite(Boolean async, Byte[] buffer,
Int32 offset, Int32 size, AsyncCallback callback, Object state)
at System.Net.ConnectStream.Write(Byte[] buffer, Int32 offset, Int32
size)
at TestApplication.ClientProxy.EndPostXmlMessageRequest(IAsyncResult
asyncResult)
at TestApplication.ClientProxy.EndVerifyRequest(IAsyncResult
asyncResultRequest)
at
TestApplication.Async.AsyncVerification.EndAsyncVerifyRequest(IAsyncResult
asyncResult)

We recently found out that a bug in .NET framework 2.0 sometimes results in
a connection closed causes by a Keep-Alive connection time out. This was
fixed in SP1.
I have asked the customer i they have installer SP1 on there production
machines.
 
J

John Saunders [MVP]

Martijn van Schie said:
Hi John,

It's hard for me to reproduce it using HTTP, because we are using a test
WebService from a third party authorisation service.

The entire stacktrace comes to this:

Stack Trace :
at System.Net.ConnectStream.InternalWrite(Boolean async, Byte[] buffer,
Int32 offset, Int32 size, AsyncCallback callback, Object state)
at System.Net.ConnectStream.Write(Byte[] buffer, Int32 offset, Int32
size)
at TestApplication.ClientProxy.EndPostXmlMessageRequest(IAsyncResult
asyncResult)
at TestApplication.ClientProxy.EndVerifyRequest(IAsyncResult
asyncResultRequest)
at
TestApplication.Async.AsyncVerification.EndAsyncVerifyRequest(IAsyncResult
asyncResult)

That's an interesting pattern of End* method calls. Can you provide an
outline of the pattern of async calling? Is EndPostXmlMessageRequest your
code? Does it explicitly call Write on the stream?

Also, in this case, it's possible that more than just the stack trace may be
interesting. Can you provide the output of ex.ToString()? That is, when you
catch the exception, run ToString on the caught exception, then post the
result. That will include all of the nested InnerException instances.
 
M

Martijn van Schie

Hi John,

Our customer let me know today that the issue is resolved after installing
SP1.
I agree on the End* stack :). The application is programmed to be very
generic and modulated, and yes, the EndPostXmlMessageRequest is ours. It's
handles the callback from a custom soap request to a webservice proxy using
the HttpWebRequest object.

One problem is that i can't reproduce the issue that easily anymore, as i
installed SP1 on both the test and development machine. I might have a stack
for you from an eventlog backup or issue tracker. I'll try to find one and
post it for you.

Thank you for your time anyways.

Regards,
Martijn


John Saunders said:
Martijn van Schie said:
Hi John,

It's hard for me to reproduce it using HTTP, because we are using a test
WebService from a third party authorisation service.

The entire stacktrace comes to this:

Stack Trace :
at System.Net.ConnectStream.InternalWrite(Boolean async, Byte[]
buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
at System.Net.ConnectStream.Write(Byte[] buffer, Int32 offset, Int32
size)
at TestApplication.ClientProxy.EndPostXmlMessageRequest(IAsyncResult
asyncResult)
at TestApplication.ClientProxy.EndVerifyRequest(IAsyncResult
asyncResultRequest)
at
TestApplication.Async.AsyncVerification.EndAsyncVerifyRequest(IAsyncResult
asyncResult)

That's an interesting pattern of End* method calls. Can you provide an
outline of the pattern of async calling? Is EndPostXmlMessageRequest your
code? Does it explicitly call Write on the stream?

Also, in this case, it's possible that more than just the stack trace may
be interesting. Can you provide the output of ex.ToString()? That is, when
you catch the exception, run ToString on the caught exception, then post
the result. That will include all of the nested InnerException instances.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top