U4-537 - Macro.cs - Thread was being aborted

Created by Sebastiaan Janssen 19 Aug 2012, 14:53:53 Updated by Pedro Gomes Adão 01 Feb 2013, 15:06:41

Under heavy load I get the following error in macro.cs. I'm logging the error from the catch block on line 386. This is Umbraco 4.7.1.1

Thread was being aborted. at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage) at umbraco.macro.loadMacroScript(MacroModel macro) at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId)

''Originally created on CodePlex by [morfy50|http://www.codeplex.com/site/users/view/morfy50]'' on 2/14/2012 6:21:05 AM [Codeplex ID: 30734 - Codeplex Votes: 2]

Comments

Sébastien Richer 02 Oct 2012, 20:07:01

I get this on my live website running on 4.7.2. And I have to note that "heavy" load is relative, but not all that heavy in most contexts (around 5 million hits a year --> 10 hits a minute average).


Igor Samochernov 06 Oct 2012, 05:35:02

We experience sporadic Razor macro load errors on 4.7.2. The site has about 5 requests per a second. Trace message: umbracoMacro Error loading MacroEngine script (file: [Ad]SearchForm.cshtml, Type: '' Thread was being aborted. at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId)


Sebastiaan Janssen 06 Oct 2012, 18:18:24

Igor, make sure to read and participate in [this thread|http://our.umbraco.org/forum/developers/api-questions/8584-Severe-Issue-with-macro-caching-under-heavy-load?p=14] to figure out what your specific problem might be. I am actually expecting it's an issue with your code and not in the core as the fix was provided for 4.7.2. Although, it could be something we've missed but it doesn't look like it.


Igor Samochernov 07 Oct 2012, 08:35:47

Sebastiaan, I've passed through the thread. Doesn't look to be our case. The problem does not seem to be related to our code - different macros fail arbitrarily but work well after page refresh. We are updating the website to 4.9. Hopely the issue is resolved there.


Igor Samochernov 30 Nov 2012, 09:56:35

We have transfered the website code to a clean 4.9 installation and still experience the mentioned problem. Random macro fail at random times on page load once in 20 or 30 page reloads. But when you hit reload after it, the page refreshes with no errors. Any advise beside debugging Umbraco code?


Sebastiaan Janssen 30 Nov 2012, 11:47:26

@Igor does your code use Response.Redirect("some url", true); somewhere instead of Response.Redirect("some url", false);? Try the logging mentioned at the last post here: http://our.umbraco.org/forum/developers/api-questions/8584-Severe-Issue-with-macro-caching-under-heavy-load?p=16

Other than that, everybody who was experiencing this problem before is now reporting it fixed in the new version.


Sébastien Richer 30 Nov 2012, 13:43:39

Hi Igor, In my case it was calls to Response.Redirect(url) without the 2nd parameter set to false that was causing the issue. Changing to

Response.Redirect(url, false); Context.ApplicationInstance.CompleteRequest();

throughout my project fixed my issue.


Igor Samochernov 30 Nov 2012, 13:51:26

Indeed, I see a number of such redirects in several of our macros - not much relevant to ones that I noticed failed. Will try your fix and see what changes.


Sébastien Richer 30 Nov 2012, 14:01:10

From my limited understanding of IIS and .Net pipelines, this is impossible, but practical facts tend to indicate that "other users' requests" were making other requests "end" prematurely... Quite odd...


Igor Samochernov 20 Dec 2012, 11:42:05

Works perfectly after the fix. Thanks


Pedro Gomes Adão 01 Feb 2013, 11:38:18

I have this error on 4.7.2. Do I have to upgrade umbraco to 4.8 or just change all my Response.Redirect to "false"?


Igor Samochernov 01 Feb 2013, 13:41:58

Upgrade does not help. You should update all redirect method calls


Pedro Gomes Adão 01 Feb 2013, 15:06:41

Thank you so much. =)


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version: 4.8.0

Sprint:

Story Points:

Cycle: