System.OutOfMemoryException when initializing a new entity with large blob

Posts   
 
    
Davi-D
User
Posts: 4
Joined: 28-Oct-2008
# Posted on: 28-Oct-2008 16:32:17   

When the following code is executed an exception occurs.

        
public FileUpload(Guid guiFileUploadId)
{
    Data.HelperClasses.DbUtils.CommandTimeOut = 600;
    m_guiFileUploadId = guiFileUploadId;
    FileUploadEntity = new FileUploadEntity(m_guiFileUploadId);
    LoadFromDataSource();
}

Message: Exception of type 'System.OutOfMemoryException' was thrown. Source: System.Data Stacktrace: at System.Data.SqlTypes.SqlBinary.get_Value() at System.Data.SqlClient.SqlBuffer.get_ByteArray() at System.Data.SqlClient.SqlBuffer.get_Value() at System.Data.SqlClient.SqlDataReader.GetValueInternal(Int32 i) at System.Data.SqlClient.SqlDataReader.GetValues(Object[] values) at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.FetchOneRow(IDataReader dataSource, IEntityFields rowDestination, IFieldPersistenceInfo[] fieldPersistenceInfos) at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.ExecuteSingleRowRetrievalQuery(IRetrievalQuery queryToExecute, ITransaction containingTransaction, IEntityFields fieldsToFill, IFieldPersistenceInfo[] fieldPersistenceInfos) at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.PerformFetchEntityAction(IEntity entityToFetch, ITransaction containingTransaction, IPredicateExpression selectFilter, IPrefetchPath prefetchPathToUse, Context contextToUse, ExcludeIncludeFieldsList excludedIncludedFields) at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.FetchExisting(IEntity entityToFetch, ITransaction containingTransaction, IPrefetchPath prefetchPathToUse, Context contextToUse, ExcludeIncludeFieldsList excludedIncludedFields) at Data.EntityClasses.FileUploadEntityBase.Fetch(Guid fileUploadId, IPrefetchPath prefetchPathToUse, Context contextToUse, ExcludeIncludeFieldsList excludedIncludedFields) at Data.EntityClasses.FileUploadEntityBase.InitClassFetch(Guid fileUploadId, IValidator validator, IPrefetchPath prefetchPathToUse) at Data.EntityClasses.FileUploadEntity..ctor(Guid fileUploadId)

LLBLGen Pro version: 2.6 final released on September 26th 2008 Template group: Selfservicing.TwoClasses2005 .Net Version: 2.0 Database type / version: Sql server 2005 9.0.3054

The exception only occurs when the entity contains a very larger blob. If the blob becomes large then 250mb the exceptions occurs. Otherwise everything works fine.

P.S. A couple of months ago when everything was tested it was possible to use blob's up to 2gb. Since then the only thing that has changed are the windows updates.

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 28-Oct-2008 22:20:11   

Hi

If possible could you also use something like DotNet VersionCheck to check the exact version of the .Net 2.0 runtime installed on the machine...?

Do you get the same result on other machines ? If you can find a machine that it still works on could you check the .Net version on that one as well.

What is the OS/Service Pack on the failing machine...?

Thanks

Matt

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39861
Joined: 17-Aug-2003
# Posted on: 29-Oct-2008 09:59:20   

Also, if sqlserver has not enough breathing space for the large blob, it won't work.

It might be better as well to look into file-system storage for these kind of large files, as you then avoid having the sqlserver process to fetch all the blob data in memory.

Frans Bouma | Lead developer LLBLGen Pro
Davi-D
User
Posts: 4
Joined: 28-Oct-2008
# Posted on: 30-Oct-2008 08:53:50   

MTrinder wrote:

Hi

If possible could you also use something like DotNet VersionCheck to check the exact version of the .Net 2.0 runtime installed on the machine...?

Do you get the same result on other machines ? If you can find a machine that it still works on could you check the .Net version on that one as well.

What is the OS/Service Pack on the failing machine...?

Thanks

Matt

I tested it on two machiennes: OS: Windows XP Professional Service Pack 3 Installed .Net Runtime(s) 1.1.4322.2407 2.0.50727.3053 3.0.4506.2152 ADO Database Runtime Version: 2.81.1132.0 RAM: 3 GB CPU: Intel Q9450 2.66 GHz

OS: Windows Server 2003 Standard Edition Service pack 2 Installed .Net Runtime(s) 1.1.4322.2407 2.0.50727.1433 3.0.4506.648 ADO Database Runtime Version: 2.82.3959.0 RAM: 1 GB CPU: Xeon 2.33 GHz

Hope this helps

Davi-D
User
Posts: 4
Joined: 28-Oct-2008
# Posted on: 30-Oct-2008 08:57:25   

Otis wrote:

Also, if sqlserver has not enough breathing space for the large blob, it won't work.

It might be better as well to look into file-system storage for these kind of large files, as you then avoid having the sqlserver process to fetch all the blob data in memory.

I also prefer file-system storage. However this project requires in database storage (temporally). The SQL server has got enough breathing space. When i select the same file in Sql server Management Studio it show up within a couple of seconds. I really think it has got something to do with the application. The tests on the first machine give the out of memory exception even when there's 2.5gb of free RAM.

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 30-Oct-2008 10:24:00   

Saying the obvious, there is a shortage of memory. Googling didn't get me much except this thread: https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2184170&SiteID=1

Is this a web or windows application? Any remoting in there?

Davi-D
User
Posts: 4
Joined: 28-Oct-2008
# Posted on: 30-Oct-2008 12:24:36   

Walaa wrote:

Saying the obvious, there is a shortage of memory. Googling didn't get me much except this thread: https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2184170&SiteID=1

Is this a web or windows application? Any remoting in there?

Yes, one would say there isn't enough memory available. The funny thing however is when the exception occurs there is still 2 -3 GB available. (both web application-server and sql-server)

It is a web application. No remoting

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39861
Joined: 17-Aug-2003
# Posted on: 30-Oct-2008 19:07:53   

It could be the memory set for the applicationpool is way less, and when that memory is running out, you either get a recycle or an out of memory exception.

Frans Bouma | Lead developer LLBLGen Pro