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 7046969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:42:50+00:00 2026-05-28T02:42:50+00:00

As far as I remember, a role instance should automatically perform a restart after

  • 0

As far as I remember, a role instance should automatically perform a restart after a crash/failure.
In order to test that behaviour, I wrote an application that enforces an out-of-memory-exception and my application crashed. The role instance didn’t perform a restart, because it was still running and ok – the instance just restartet the .NET runtime.

I’m trying to find out how an instance reacts on different errors. In my case, a restart wasn’t necessary. What type of errors/exceptions (that I can enforce) would cause a complete restart of an instance? What type of errors/exceptions would kill an instance forever?

  • 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-28T02:42:51+00:00Added an answer on May 28, 2026 at 2:42 am

    The only reason that causes a role instance to be recycled (restarted) is when the Run method of RoleEntryPoint exits. This typically happens when you:

    1. Overrided Run() method, and
    2. Have an unhandled exception in your program code, that would cause the Run() method to exit

    Your role however would recycle, but rather hang, when you have enabled IntelliTrace logs collection.

    The default template for a WebRole does not override Run() method, thus leaving the default implementation, which is “Thread.Sleep(-1);”. There is no (auto) event that would cause automatic role recycling of a WebRole. Unless you do something in your RoleEntryPoint, that would cause Run method to exit. This automatic recycling only happens with WorkerRole, which do implement the Run() method.

    UPDATE 1 (acording to comment 1)

    run-Methoded of a RoleEntryPoint faces an error
    

    Not just an error, but such kind of error (i.e. an unhandled exception), which causes the Run() method to exit.

    Moreover, you can’t just override the Run() in your WebRole, becasue your RoleEntryPoint descendat lives in different app domain (even different process) then your web application (so it will have no idea about your application’s exceptions). Read more about Full IIS hosting and process here.

    So, for a web role you just have a web application in fully features IIS 7.0 / 7.5, which has no idea that this IIS is part of an Azure deployment. Global.asax is your place to manage unhandled web application errors in ASP.NET. Check out this question, the answer of which provides a good example for Application_Error() handler.

    You could use the RequestRecycle static method of RoleEnvironment type to manually require role recycling in your Application_Error() method. However don’t recommend you to do so. I don’t see a good practice in restarting the web server because of an application error. You should implement good exception handling and error logging strategy, regulary examine your error logs and take actions to avoid crytical errors that would require server restart.

    What is your original intent? To understand when a Role will be automacitally recycled, or to model your application such as to automatically recycle your role on error? If it is the latter, I suggest that you revise your business requirements/logic.

    UPDATE 2

    I can’t talk from Neil’s mouth, but “instance failure” is everything that can cause a running VM to hang. Instance in Windows Azure is a signle Virtual Machine that hosts your application’s code (read this blog post for detailed explanaition on Hosted Service, Role, Instance). Your application runs in a Windows Server based OS. It is a virtual machine. Anything could happen – from hardware failure on the host, to a generic software/driver failure of the guest OS. It is not neccessary to be your code. So in case something happens which would cause a single VM to fail – this issue is automatically handled by the Windows Azure Fabric. If it neccessary – your code is automatically deployed to another virtual machine. And this happens automagically. You do nohting. Imagine a HDD breaks, or a memory module burns out, or a network interface stops responding – these are just a few simple issues that could cause a running VM to fail. This is an instance failure.

    A failure in your code is something that you should take care of. Everything else – Windows Azure Fabric controller takes care of.

    UPDATE 3

    1. What happens to an asp.net application in a webrole if an exception occurs and it is not handled? Will the application just hang in an
      undefined state (“broken”) until I look for it or will it be
      terminated by the vm?

    This question is totally out of scope! What happens to an asp.net application in a shared hosting account? Or in on-premise IIS installation? Application crash for the user whose actions caused the crash. The worst case app pool recycle. I have never seen a “hung” asp.net application. There is no such thing as “terminated asp.net application” or “broken”. If it is a generic error that is caused during application startup or first request – the application will never be online. If it is error caused by some sequence of user actions – user will see an ugly error message and nothing more (unless you have appropriate Application_Error() handler in your Global.asax. I think it is enough explanations for a question having nothing to do with Azure.

    1. Can you think of a piece of .NET code in my application that could cause the crash of a whole web role or it is not possible with
      managed code (apart from an unknown bug in .NET)?

    Are you kidding? This code will crash your web role and will force a recycling:

    RoleEnvironment.RequestRecycle()
    

    Please accept this question, as I don’t think there is something missing. Plus it has answers to at least 4 more questions, added to the original one.

    FINAL

    There is no such thing as “kill the instance forever”.

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

Sidebar

Related Questions

As far as I remember there exists an Eclipse plugin that reveals ids of
As far as I remember, in pure W3C event model (that means, using addEventListener),
As far as I remember, Visual Studio (both 2008 and 2010) used to have
This has / may have been asked before, but, as far as I remember,
As far as variable naming conventions go, should iterators be named i or something
I remember all the hassle it used to be processing strings and ensuring that
I remember having seen somwhere that it is possible to tell where a user
I'm a bit confused, as far as I remember the Textbox used to launch
While, as far as I remember, IEEE 754 says nothing about a flush-to-zero mode
As far back as I remember ~1997, web browsers have been very literal in

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.