ThreadAbortException and long running scheduled jobs

We were experiencing some weirdness, seemingly random thread death of long-running scheduled jobs and background worker threads, in our development environments. This was bad.

Looking through the IIS event log I found

A worker process with process id of ‘7156’ serving application pool ‘dev.pool’ was shutdown due to inactivity. Application Pool timeout configuration was set to 20 minutes. A new worker process will be started when needed.

What was happening was that because we were waiting for the background tasks to complete the worker idle timeout was being exceeded, as it defaults to 20 minutes, and there was no site activity. [No requests! Though the background process was doing some work.]

The way to fix this is simple. We kill the Batman. Ahem, I mean, we disable the worker process idle timeout. As the app pool was set to recycle at a set time there should be no reason to recycle due to ‘idleness’. [On the prod environments, with their various monitoring apps, it would never happen. But on our QA machine and dev machines this was an issue for testing these kinds of long running jobs]

In IIS go to the app pool that you are using for EPiServer CMS and click the Advanced Settings link. Then scroll to Process Model and set Idle Time-out (minutes) to 0.
This will ensure that in your testing environments it never times out.
app-pool-adv-settings

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s