Bugzilla – Bug 325166
[PATCH][WIN32] Databinding will produce "Out of Memory" Exceptions
Last modified: 2007-09-15 21:24:46 UTC
---- Reported by raterus@gmail.com 2007-08-20 12:43:50 MST ---- Description of Problem: I'm using XSP2 in Windows XP. I have a simple test page I've created that shows how XSP2 will run out of memory on a fairly staight-forward example. Steps to reproduce the problem: 1. Extract the attached test case to ./monotest 2. Run xsp2 on ./monotest 3. Load http://localhost:8080/Default.aspx 4. You may or may not need to increase the number of "maxrows" on line 30 of Default.aspx.cs. 200 "maxRows" was enough to sufficiently get "Out of Memory" exceptions for me. If you set the value to something small (like 5), you should not receive an exception. Actual Results: Server Error in '/' Application Out of memory. Description: Error processing request. Error Message: HTTP 500. System.OutOfMemoryException: Out of memory. Stack Trace: System.OutOfMemoryException: Out of memory. at <0x00000> <unknown method> at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal:ReAllocHGlobal (intptr,intptr) at System.Web.HttpResponseStream+BlockManager.EnsureCapacity (Int32 capacity) [0x00000] at System.Web.HttpResponseStream+BlockManager.Write (System.Byte[] buffer, Int32 offset, Int32 count) [0x00000] at System.Web.HttpResponseStream+ByteBucket.Write (System.Byte[] buf, Int32 offset, Int32 count) [0x00000] at System.Web.HttpResponseStream.AppendBuffer (System.Byte[] buffer, Int32 offset, Int32 count) [0x00000] at System.Web.HttpResponseStream.Write (System.Byte[] buffer, Int32 offset, Int32 count) [0x00000] at System.Web.HttpWriter.WriteString (System.String s, Int32 index, Int32 count) [0x00000] at System.Web.HttpWriter.Write (System.String s) [0x00000] at System.Web.UI.HtmlTextWriter.Write (System.String s) [0x00000] at System.Web.UI.HtmlTextWriter.WriteBeginTag (System.String tagName) [0x00000] at System.Web.UI.HtmlTextWriter.DoBeginTag () [0x00000] at System.Web.UI.HtmlTextWriter.RenderBeginTag (HtmlTextWriterTag tagKey) [0x00000] at System.Web.UI.WebControls.WebControl.RenderBeginTag (System.Web.UI.HtmlTextWriter writer) [0x00000] at System.Web.UI.WebControls.WebControl.Render (System.Web.UI.HtmlTextWriter writer) [0x00000] at System.Web.UI.Control.RenderControl (System.Web.UI.HtmlTextWriter writer) [0x00000] at System.Web.UI.Control.RenderChildren (System.Web.UI.HtmlTextWriter writer) [0x00000] at System.Web.UI.Control.Render (System.Web.UI.HtmlTextWriter writer) [0x00000] at System.Web.UI.WebControls.WebControl.RenderContents (System.Web.UI.HtmlTextWriter writer) [0x00000] at System.Web.UI.WebControls.WebControl.Render (System.Web.UI.HtmlTextWriter writer) [0x00000] at System.Web.UI.Control.RenderControl (System.Web.UI.HtmlTextWriter writer) [0x00000] at System.Web.UI.WebControls.Table.RenderContents (System.Web.UI.HtmlTextWriter writer) [0x00000] at System.Web.UI.WebControls.WebControl.Render (System.Web.UI.HtmlTextWriter writer) [0x00000] at System.Web.UI.WebControls.GridView.RenderGrid (System.Web.UI.HtmlTextWriter writer) [0x00000] at System.Web.UI.WebControls.GridView.Render (System.Web.UI.HtmlTextWriter writer) [0x00000] at System.Web.UI.Control.RenderControl (System.Web.UI.HtmlTextWriter writer) [0x00000] at System.Web.UI.Control.RenderChildren (System.Web.UI.HtmlTextWriter writer) [0x00000] at System.Web.UI.HtmlControls.HtmlForm.RenderChildren (System.Web.UI.HtmlTextWriter w) [0x00000] at System.Web.UI.HtmlControls.HtmlContainerControl.Render (System.Web.UI.HtmlTextWriter writer) [0x00000] at System.Web.UI.HtmlControls.HtmlForm.Render (System.Web.UI.HtmlTextWriter w) [0x00000] at System.Web.UI.Control.RenderControl (System.Web.UI.HtmlTextWriter writer) [0x00000] at System.Web.UI.HtmlControls.HtmlForm.RenderControl (System.Web.UI.HtmlTextWriter w) [0x00000] at System.Web.UI.Control.RenderChildren (System.Web.UI.HtmlTextWriter writer) [0x00000] at System.Web.UI.Control.Render (System.Web.UI.HtmlTextWriter writer) [0x00000] at System.Web.UI.Page.Render (System.Web.UI.HtmlTextWriter writer) [0x00000] at System.Web.UI.Control.RenderControl (System.Web.UI.HtmlTextWriter writer) [0x00000] at System.Web.UI.Page.InternalProcessRequest () [0x00000] at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) [0x00000] Expected Results: xsp2 / mono / asp.net should not run out of memory on such a simple test case. Also, xsp2 on CentOS 4.5 is not having the same problem. How often does this happen? Always Additional Information: This looks like a xsp2 issue, when it is hosted on Windows XP, but the issue may ultimately be in mono: Class Libraries/sys.web ---- Additional Comments From raterus@gmail.com 2007-08-20 12:44:40 MST ---- Created an attachment (id=172519) Test Case ---- Additional Comments From robertj@gmx.net 2007-08-22 16:21:26 MST ---- Hmm, it appears that ReAllocHGlobal (respectively Win32's GlobalAlloc) is failing to realloc for some reason. Replacing all *HGlobal calls with the corresponding *CoTaskMem fixes the problem. I'm looking at it. ---- Additional Comments From robertj@gmx.net 2007-08-23 02:16:51 MST ---- Created an attachment (id=172520) marshal.c.diff ---- Additional Comments From robertj@gmx.net 2007-08-23 02:27:09 MST ---- When the GMEM_MOVEABLE flag is not applied, GlobalReAlloc () is failing when the new size is >> than the original size of the block. ---- Additional Comments From robertj@gmx.net 2007-08-23 16:44:19 MST ---- Fixed in r84747. Imported an attachment (id=172519) Imported an attachment (id=172520) Unknown bug field "cf_op_sys_details" encountered while moving bug <cf_op_sys_details>Windows XP Professional</cf_op_sys_details> Unknown operating system unknown. Setting to default OS "Other".