[Mono-bugs] [Bug 59603][Blo] Changed - out of memory error with npgsql and mono

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 10 Jun 2004 14:37:40 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by fxjrlists@yahoo.com.br.

http://bugzilla.ximian.com/show_bug.cgi?id=59603

--- shadow/59603	2004-06-09 02:34:26.000000000 -0400
+++ shadow/59603.tmp.19345	2004-06-10 14:37:40.000000000 -0400
@@ -1,12 +1,12 @@
 Bug#: 59603
 Product: Mono: Runtime
 Version: unspecified
 OS: Debian Woody
 OS Details: sid
-Status: NEW   
+Status: ASSIGNED   
 Resolution: 
 Severity: Unknown
 Priority: Blocker
 Component: misc
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: kiorky@goddess-gate.com               
@@ -145,6 +145,39 @@
 0x00000090: C6 CE EA 26 B0 77 BC 46 CA C9 38 00 43 5E 77 EE 
 Culture:       
 														}
 
 ------- Additional Comments From kiorky@goddess-gate.com  2004-06-09 02:34 -------
 kernel changed to 2.6.6 but same result
+
+------- Additional Comments From fxjrlists@yahoo.com.br  2004-06-10 14:37 -------
+
+Ok, I found the problem.
+
+It is in the fact that NpgsqlDataReader is returning -1 as the field
+count because there are delete many inserts as well as the select
+statement in the same query and the documentation says DataReader
+should return -1 in all queries but select. NpgsqlDataReader is
+holding all the resultsets and fill method expects that the data being
+used is available in the DataReader while it is not.
+
+If you add the following lines to your example:
+cmd.ExecuteNonQuery();
+
+cmd.CommandText = "select * from popo";
+
+it will work perfectly.
+
+The problem of Out of memory exception is created by this line in
+DbDataAdapter[470]:
+int[] mapping = new int[reader.FieldCount]; // mapping the reader
+indexes to the datatable indexes
+
+As the reader is returning -1, this array is initialized incorrectly
+which causes the next line to throw this exception. You can test it
+yourself by adding the following lines:
+
+int i = -1;
+int[] j = new int[i]; //mcs complains if putting -1 directly
+
+Console.WriteLine("hi"); // this throws the out of memory exception.
+