Intermittent ThreadAbortException while processing posted XML

S

splap20

Every day a large chunk of XML is posted up to my app via http. The app
interprets this XML and writes results to a SQLServer. Occasionally a
ThreadAbortException is thrown during this process. Despite being
caught, this exception propagates all the way up the call stack. I know
this is by design and that I can use Thread.ResetAbort to stop this
exception from bubbling up the stack.

But I want to know why the exception is thrown in the first place.

My app is not multithreaded, and I never call Thread.Abort directly.
Maybe something I am doing causes it to be called but I don't know
what that could be.

I know that Response.Redirect and Response.End throw a
ThreadAbortException, but I do not use either of those. Instead I use
HttpContext.Current.ApplicationInstance.CompleteRequest() which I
presume also throws a ThreadAbortException. But since this is only
called when the job is complete, I do not see how this could be a
problem.

At this point I am guessing that a setting in my machine.config or
web.config is telling IIS to kill my process from some reason. I have
set machine.config's httpRuntime attributes executionTimeout and
maxRequestLength to 2 hours (way longer than the job takes) and 1gig
(way bigger than the posted xml) respectively.

Any ideas how to figure out why I am getting this ThreadAbortException?
 
B

bruce barker

most likely the xml post to your site is failing, causing a IIS connection
close/timeout/error, causing the iis to asp.net pipe to be closed, causing
a asp.net thread abort. you should expect this behavior, as the internet is
not reliable.

-- bruce (sqlwork.com)

| Every day a large chunk of XML is posted up to my app via http. The app
| interprets this XML and writes results to a SQLServer. Occasionally a
| ThreadAbortException is thrown during this process. Despite being
| caught, this exception propagates all the way up the call stack. I know
| this is by design and that I can use Thread.ResetAbort to stop this
| exception from bubbling up the stack.
|
| But I want to know why the exception is thrown in the first place.
|
| My app is not multithreaded, and I never call Thread.Abort directly.
| Maybe something I am doing causes it to be called but I don't know
| what that could be.
|
| I know that Response.Redirect and Response.End throw a
| ThreadAbortException, but I do not use either of those. Instead I use
| HttpContext.Current.ApplicationInstance.CompleteRequest() which I
| presume also throws a ThreadAbortException. But since this is only
| called when the job is complete, I do not see how this could be a
| problem.
|
| At this point I am guessing that a setting in my machine.config or
| web.config is telling IIS to kill my process from some reason. I have
| set machine.config's httpRuntime attributes executionTimeout and
| maxRequestLength to 2 hours (way longer than the job takes) and 1gig
| (way bigger than the posted xml) respectively.
|
| Any ideas how to figure out why I am getting this ThreadAbortException?
|
 
J

james

Bruce,

Thanks for taking the time to respond.

When this error occurs, the complete XML post has been validated and
logged to the file system -- so I am sure that the document made it
into MyApp. The http post is happening on a local network - not going
through the internet. I have confirmed that PostingApp has a huge http
timeout and that it can keep open http pipes for much longer than I
need. I have an old VB6 version of MyApp that can handle posts of this
size from the same PostingApp with no problems. Because of this am
assuming the issue is with MyApp.

Another bit of information I missed in the first post: The requests
that have died with this exception do not take longer to run and do not
contain larger post data than some other successful requests. They are
significantly bigger and slower than the average post but are not the
biggest or slowest.
 
J

james

Bruce,

Thanks for taking the time to respond.

When this error occurs, the complete XML post has been validated and
logged to the file system -- so I am sure that the document made it
into MyApp. The http post is happening on a local network - not going
through the internet. I have confirmed that PostingApp has a huge http
timeout and that it can keep open http pipes for much longer than I
need. I have an old VB6 version of MyApp that can handle posts of this
size from the same PostingApp with no problems. Because of this am
assuming the issue is with MyApp.

Another bit of information I missed in the first post: The requests
that have died with this exception do not take longer to run and do not
contain larger post data than some other successful requests. They are
significantly bigger and slower than the average post but are not the
biggest or slowest.
 
J

james

Bruce,

Thanks for taking the time to respond.

When this error occurs, the complete XML post has been validated and
logged to the file system -- so I am sure that the document made it
into MyApp. The http post is happening on a local network - not going
through the internet. I have confirmed that PostingApp has a huge http
timeout and that it can keep open http pipes for much longer than I
need. I have an old VB6 version of MyApp that can handle posts of this
size from the same PostingApp with no problems. Because of this am
assuming the issue is with MyApp.

Another bit of information I missed in the first post: The requests
that have died with this exception do not take longer to run and do not
contain larger post data than some other successful requests. They are
significantly bigger and slower than the average post but are not the
biggest or slowest.
 

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

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top