2

We're running a web service as a web site project. Clients make requests which return after a few seconds, but which spawn a thread that should run for hours. The thread makes web requests and writes to a database, and is throttled with Thread.Sleep calls.

After running for about 20 minutes with several threads running, all the threads receive a ThreadAbortException at the same time. Thread.resetAbort doesn't help. The exception can occur during a SQL call, during a web request or during a Thread.Sleep.

I thought the problem might be the httpRuntime attribute executionTimeout in web.config, but that didn't solve the issue.

Any other ideas what might be killing off all our threads?

2
  • Did you look at your session timeout? I'm guessing that these threads are owned by a session rather than the app, and as such may be subject to that timeout. Commented Aug 21, 2009 at 17:15
  • Good thought, but we're not using the session. Commented Aug 21, 2009 at 17:21

2 Answers 2

3

I would guess that the web application owns the thread, and the application shuts down after a period of time.

If I were architecting something like this, I would write a web services which takes yourp your clients requests and puts them in a database, then I'd write a windows service that polls that database for client requests and spawns the threads which do whatever it is you need (makes web requests and write to a database). It sounds like your writing some sort of processor engine, and I don't think an asp.net app is a good place to host that kind of thing.

1
  • Agreed. I don't control the architecture on this project, but these kinds of problems are good fuel for that argument. Commented Aug 21, 2009 at 17:30
2

The application pool in IIS has an idle time-out. It needed to be turned off.

(Administrative Tools > IIS. Right-click the application pool > properties. Performance tab.)

Not the answer you're looking for? Browse other questions tagged or ask your own question.