This is a migrated thread and some comments may be shown as answers.

[Solved] HttpHandler OutOfMemoryException

5 Answers 115 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nabil Shuhaiber
Top achievements
Rank 1
Nabil Shuhaiber asked on 03 Sep 2009, 01:15 PM
I received the below exception. Is this a bug in the decompression?  Thanks


Exception of type 'System.OutOfMemoryException' was thrown.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.

Source Error:

Line 108:                ms.Write(compressed, 4, compressed.Length - 4);
Line 109:
Line 110: binary = new byte[length];Line 111:
Line 112:                ms.Seek(0, SeekOrigin.Begin);

Source File: c:\Dev\TelerikASPNETMVC\Telerik.Web.Mvc\Extensions\StringExtensions.cs    Line: 110

Stack Trace:

[OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.]
   Telerik.Web.Mvc.Extensions.StringExtensions.Decompress(String instance) in c:\Dev\TelerikASPNETMVC\Telerik.Web.Mvc\Extensions\StringExtensions.cs:110
   Telerik.Web.Mvc.WebAssetRegistry.Decompress(String target) in c:\Dev\TelerikASPNETMVC\Telerik.Web.Mvc\WebAssetRegistry.cs:206
   Telerik.Web.Mvc.WebAssetRegistry.CreateMergedAssetFrom(String id) in c:\Dev\TelerikASPNETMVC\Telerik.Web.Mvc\WebAssetRegistry.cs:126
   Telerik.Web.Mvc.WebAssetRegistry.Retrieve(String id) in c:\Dev\TelerikASPNETMVC\Telerik.Web.Mvc\WebAssetRegistry.cs:108
   Telerik.Web.Mvc.WebAssetHttpHandler.ProcessRequest(HttpContextBase context) in c:\Dev\TelerikASPNETMVC\Telerik.Web.Mvc\WebAssetHttpHandler.cs:104
   Telerik.Web.Mvc.Infrastructure.HttpHandlerBase.ProcessRequest(HttpContext context) in c:\Dev\TelerikASPNETMVC\Telerik.Web.Mvc\Infrastructure\HttpHandlerBase.cs:36
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75



Version Information: Microsoft .NET Framework Version:2.0.50727.4005; ASP.NET Version:2.0.50727.3053

5 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 03 Sep 2009, 02:05 PM
Hello Nabil Shuhaiber,

You may have discovered a bug indeed. Could you please paste here the declaration of your ScriptRegistrar? Also are you using any other components?

Regards,
Atanas Korchev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Martin
Top achievements
Rank 1
answered on 15 Sep 2009, 08:24 AM

I have the same problem. Here is my script registrar:

 

 

Html.Telerik().ScriptRegistrar().DefaultGroup(group => group.Disabled(

true))

 

.Scripts(scripts =>

scripts.AddGroup(

"CommonScript", group =>

 

group.Add(Url.ScriptsServerPath(

"jquery/jquery-1.3.2.min.js"))

 

.Add(Url.ScriptsServerPath(

"jquery/jquery-ui-1.7.2.custom.min.js"))

 

.Add(Url.ScriptsServerPath(

"SL3/Silverlight.min.js"))

 

.Add(Url.ScriptsServerPath(

"ajax/MicrosoftAjax.min.js"))

 

.Add(Url.ScriptsServerPath(

"ajax/MicrosoftMvcAjax.min.js"))

 

.Combined(

true)

 

.CacheDurationInDays(365)

.Compress(

true)

 

 

)

)

.Render();


UrlScrptsServerPath only maps to our local scripts path.

Below you will find the rendered output in the html.

   <script type="text/javascript" src="/asset.axd?id=eyJjdCI6ImFwcGxpY2F0aW9uL3gtamF2YXNjcmlwdCIsInYiOiIyMDA5LjIiLCJjIjp0cnVlLCJjZCI6MzY1LCJkIjpbeyJwIjoiQXNzZXRzL1NjcmlwdHMvanF1ZXJ5IiwiZiI6W3sibyI6MCwibiI6ImpxdWVyeS0xLjMuMi5taW4uanMifSx7Im8iOjEsIm4iOiJqcXVlcnktdWktMS43LjIuY3VzdG9tLm1pbi5qcyJ9XX0seyJwIjoiQXNzZXRzL1NjcmlwdHMvU0wzIiwiZiI6W3sibyI6MiwibiI6IlNpbHZlcmxpZ2h0Lm1pbi5qcyJ9XX0seyJwIjoiQXNzZXRzL1NjcmlwdHMvYWpheCIsImYiOlt7Im8iOjMsIm4iOiJNaWNyb3NvZnRBamF4Lm1pbi5qcyJ9LHsibyI6NCwibiI6Ik1pY3Jvc29mdE12Y0FqYXgubWluLmpzIn1dfV19"></script>
Martin

0
eti
Top achievements
Rank 1
answered on 17 Sep 2009, 10:09 AM
Any news on this one?
0
eti
Top achievements
Rank 1
answered on 18 Sep 2009, 09:16 AM
Replaying to myself here...

I think the problem is related to WebAssetRegistry::MinimumLengthToCompress .
in the compress method we have:
(target.Length > MinimumLengthToCompress): ..compress.. ? ...encode...
and in the decompress method:
(target.Length > MinimumLengthToCompress): ..decompress.. ? ...decode...

but the compress opration adds 4 bytes ( the length ) at the beginning of the stream. Either remove the minimum length check or handle the decompression differently.
0
Kazi Manzur Rashid
Telerik team
answered on 18 Sep 2009, 10:45 AM
Hi eti,

I think you are absolutely correct. Please use the following code in WebAssetRegistry, for the time being:

private static string Compress(string target)
{
    return target.Compress();
 }

private static string Decompress(string target)
{
    return target.Decompress();
}

Kind regards,
Kazi Manzur Rashid
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
Nabil Shuhaiber
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Martin
Top achievements
Rank 1
eti
Top achievements
Rank 1
Kazi Manzur Rashid
Telerik team
Share this question
or