Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6606531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:24:21+00:00 2026-05-25T19:24:21+00:00

I have a web application that does the following: You click a button to

  • 0

I have a web application that does the following:

You click a button to instantiate a singleton, which creates a Thread. That Thread runs continuously doing some HTTP requests to gather some data. You can click a stop button that calls the Abort() method on the thread and the application stops making HTTP requests. When I start/stop it manually, everything works fine.

My problem occurs when ever I “touch” web.config. The CPU (w3wp.exe process) spikes and the website stops responding. Does anybody know why this is happening? Shouldn’t an update to web.config reset everything?

Sample code is below:

private static MyProcessor mp = null;
private Thread theThread = null;
private string status = STOP;
public static string STOP = "Stopped";
public static string START = "Started";

private MyProcessor()
{}

public static MyProcessor getInstance()
{
    if (mp == null)
    {
        mp = new MyProcessor();
    }
    return mp;
}

public void Start()
{
    if (this.status == START)
        return;

    this.theThread = new Thread(new ThreadStart(this.StartThread));
    this.theThread.Start();
    this.status = START;
}

public void Stop()
{
    if (this.theThread != null)
        this.theThread.Abort();
    this.status = STOP;
}

private void StartThread()
{
    do
    {
        try
        {
            //do some work with HTTP requests
            Thread.Sleep(1000 * 2);
        }
        catch (Exception e)
        {
            //retry - work forever
            this.StartThread();
        }
    } while (this.status == START);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:24:22+00:00Added an answer on May 25, 2026 at 7:24 pm

    I suspect this is the problem:

    private void StartThread()
    {
        do
        {
            try
            {
                //do some work with HTTP requests
                Thread.Sleep(1000 * 2);
            }
            catch (Exception e)
            {
                //The recursive call here is suspect
                //at the very least find a way to prevent infinite recursion
                //--or rethink this strategy
                this.StartThread();
            }
        } while (this.status == START);
    }
    

    When your app domain resets, you’ll get a ThreadAbort exception which will be caught here and trigger a recursive call, which will hit another exception, and another recursive call. It’s turtles all the way down!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET web application which does the following: Reads an Excel file.
I have this web application which does the following as standard to all websites
We have built a web application that accepts SOAP messages, does some processing, calls
I have a web application that comprises the following: A web project (with a
I have the following problem. I have a Seam web application which features e-mail
I am developing a web application, in which I have the following type of
I have a Perl web application that runs on both Apache and IIS6 on
I have a web application that should behave differently for internal users than external
I have a web application that is becoming rather large. I want to separate
I have a web application that needs to take a file upload from the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.