Bug 325166 (MONO82499) - [PATCH][WIN32] Databinding will produce "Out of Memory" Exceptions
Summary: [PATCH][WIN32] Databinding will produce "Out of Memory" Exceptions
Status: RESOLVED FIXED
Alias: MONO82499
Product: Mono: Runtime
Classification: Mono
Component: misc (show other bugs)
Version: 1.2
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Mono Bugs
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-20 19:43 UTC by Michael Ramey
Modified: 2007-09-15 21:24 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
Test Case (1.27 KB, application/octet-stream)
2007-08-20 19:44 UTC, Thomas Wiest
Details
marshal.c.diff (360 bytes, patch)
2007-08-23 09:16 UTC, Thomas Wiest
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 20:49:22 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".