[Mono-devel-list] DbDataAdapter fix for out of memory errors when filling datasets

Francisco Figueiredo Jr. fxjrlists at yahoo.com.br
Tue Aug 31 19:58:24 EDT 2004


S Umadevi wrote:
> Hi 

Hi Umadevi!

>   The patch looks ok for DbDataAdapater. Can you please go ahead and
> commit it to the HEAD and the mono_1_0 branch..
> 

Ok. Patched in HEAD, but when I tried to checkout mono_1_0 branch, I
was getting the following error:


cvs -z3 -d fxjr at mono-cvs.ximian.com:/cvs/public co -r mono_1_0 mcs
cvs: lock.c:178: lock_name: Assertion `(__extension__ 
(__builtin_constant_p (strlen (current_parsed_root->directory)) && 
((__builtin_constant_p (repository) && strlen (repository) < ((size_t) 
(strlen (current_parsed_root->directory)))) || (__builtin_constant_p 
(current_parsed_root->directory) && strlen 
(current_parsed_root->directory) < ((size_t) (strlen 
(current_parsed_root->directory))))) ? __extension__ ({ size_t __s1_len, 
__s2_len; (__builtin_constant_p (repository) && __builtin_constant_p 
(current_parsed_root->directory) && (__s1_len = strlen (repository), 
__s2_len = strlen (current_parsed_root->directory), (!((size_t)(const 
void *)((repository) + 1) - (size_t)(const void *)(repository) == 1) || 
__s1_len >= 4) && (!((size_t)(const void 
*)((current_parsed_root->directory) + 1) - (size_t)(const void 
*)(current_parsed_root->directory) == 1) || __s2_len >= 4)) ? memcmp 
((__const char *) (repository), (__const char *) 
(current_parsed_root->directory), (__s1_len < __s2_len ? __s1_len : 
__s2_len) + 1) : (__builtin_constant_p (repository) && ((size_t)(const 
void *)((repository) + 1) - (size_t)(const void *)(repository) == 1) && 
(__s1_len = strlen (repository), __s1_len < 4) ? (__builtin_constant_p 
(current_parsed_root->directory) && ((size_t)(const void 
*)((current_parsed_root->directory) + 1) - (size_t)(const void 
*)(current_parsed_root->directory) == 1) ? (__extension__ ({ register 
int __result = (((__const unsigned char *) (__const char *) 
(repository))[0] - ((__const unsigned char *) (__const char 
*)(current_parsed_root->directory))[0]); if (__s1_len > 0 && __result == 
0) { __result = (((__const unsigned char *) (__const char *) 
(repository))[1] - ((__const unsigned char *) (__const char *) 
(current_parsed_root->directory))[1]); if (__s1_len > 1 && __result == 
0) { __result = (((__const unsigned char *) (__const char *) 
(repository))[2] - ((__const unsigned char *) (__const char *) 
(current_parsed_root->directory))[2]); if (__s1_len > 2 && __result == 
0) __result = (((__const unsigned char *) (__const char *) 
(repository))[3] - ((__const unsigned char *) (__const char *) 
(current_parsed_root->directory))[3]); } } __result; })) : 
(__extension__ ({ __const unsigned char *__s2 = (__const unsigned char 
*) (__const char *) (current_parsed_root->directory); register int 
__result = (((__const unsigned char *) (__const char *) (repository))[0] 
- __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const 
unsigned char *) (__const char *) (repository))[1] - __s2[1]); if 
(__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) 
(__const char *) (repository))[2] - __s2[2]); if (__s1_len > 2 && 
__result == 0) __result = (((__const unsigned char *) (__const char *) 
(repository))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p 
(current_parsed_root->directory) && ((size_t)(const void 
*)((current_parsed_root->directory) + 1) - (size_t)(const void 
*)(current_parsed_root->directory) == 1) && (__s2_len = strlen 
(current_parsed_root->directory), __s2_len < 4) ? (__builtin_constant_p 
(repository) && ((size_t)(const void *)((repository) + 1) - 
(size_t)(const void *)(repository) == 1) ? (__extension__ ({ register 
int __result = (((__const unsigned char *) (__const char *) 
(repository))[0] - ((__const unsigned char *) (__const char 
*)(current_parsed_root->directory))[0]); if (__s2_len > 0 && __result == 
0) { __result = (((__const unsigned char *) (__const char *) 
(repository))[1] - ((__const unsigned char *) (__const char *) 
(current_parsed_root->directory))[1]); if (__s2_len > 1 && __result == 
0) { __result = (((__const unsigned char *) (__const char *) 
(repository))[2] - ((__const unsigned char *) (__const char *) 
(current_parsed_root->directory))[2]); if (__s2_len > 2 && __result == 
0) __result = (((__const unsigned char *) (__const char *) 
(repository))[3] - ((__const unsigned char *) (__const char *) 
(current_parsed_root->directory))[3]); } } __result; })) : 
(__extension__ ({ __const unsigned char *__s1 = (__const unsigned char 
*) (__const char *) (repository); register int __result = __s1[0] - 
((__const unsigned char *) (__const char *) 
(current_parsed_root->directory))[0]; if (__s2_len > 0 && __result == 0) 
{ __result = (__s1[1] - ((__const unsigned char *) (__const char *) 
(current_parsed_root->directory))[1]); if (__s2_len > 1 && __result == 
0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) 
(current_parsed_root->directory))[2]); if (__s2_len > 2 && __result == 
0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) 
(current_parsed_root->directory))[3]); } } __result; }))) : strcmp 
(repository, current_parsed_root->directory)))); }) : strncmp 
(repository, current_parsed_root->directory, strlen 
(current_parsed_root->directory)))) == 0' failed.
Terminated with fatal signal 11



I don't have any idea about what this problem is.

So, I couldn't add the patch to mono_1_0 branch.


> Thanks for finding the problem.
> 

You are welcome!


Regards,

Francisco Figueiredo Jr.


> 
>>>>"Francisco Figueiredo Jr." <fxjrlists at yahoo.com.br> 8/28/2004
> 
> 9:57:29 AM >>>
> 
> Hi all,
> 
> Here is a patch for handling out of memory exceptions when trying to 
> fill datasets with queries which doesn't return a resultset like
> insert, 
> delete, update.
> 
> The out of memory exception happens in the following line of 
> DbDataAdapter.cs:
> 
> around line 502.
> int[] mapping = new int[reader.FieldCount]; // mapping the reader 
> indexes to the datatable indexes
> 
> The problem is that when the query is an insert, update or delete, the
> 
> FieldCount property is -1 which gives the problem.
> 
> The compiler can detect when you try to create an array with a negative
> 
> index. But when this index is in a var, the runtime doesn't handle it 
> and gives the error. The error is like that:
> 
> 
> System.OutOfMemoryException: Out of memory.
> in (unmanaged) (wrapper managed-to-native) 
> System.Object:__icall_wrapper_mono_array_new_specific (intptr,int)
> in <0x00004> (wrapper managed-to-native) 
> System.Object:__icall_wrapper_mono_array_new_specific (intptr,int)
> in <0x00091> System.Data.Common.DbDataAdapter:BuildSchema 
> (System.Data.IDataReader,System.Data.DataTable,System.Data.SchemaType)
> in <0x00079> (wrapper remoting-invoke-with-check) 
> System.Data.Common.DbDataAdapter:BuildSchema 
> (System.Data.IDataReader,System.Data.DataTable,System.Data.SchemaType)
> in <0x00086> System.Data.Common.DbDataAdapter:FillTable 
> (System.Data.DataTable,System.Data.IDataReader,int,int,int&)
> in <0x000ad> (wrapper remoting-invoke-with-check) 
> System.Data.Common.DbDataAdapter:FillTable 
> (System.Data.DataTable,System.Data.IDataReader,int,int,int&)
> in <0x0017d> System.Data.Common.DbDataAdapter:Fill 
> (System.Data.DataSet,string,System.Data.IDataReader,int,int)
> in <0x000da> System.Data.Common.DbDataAdapter:Fill 
> (System.Data.DataSet,int,int,string,System.Data.IDbCommand,System.Data.CommandBehavior)
> in <0x00049> System.Data.Common.DbDataAdapter:Fill 
> (System.Data.DataSet,string)
> in <0x0006b> (wrapper remoting-invoke-with-check) 
> System.Data.Common.DbDataAdapter:Fill (System.Data.DataSet,string)
> 
> 
> 
> May I have to add a bugzilla entry?
> 
> The patch is attached.
> 
> Regards,
> 
> Francisco Figueiredo Jr.
> 
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 




More information about the Mono-devel-list mailing list