OutOfMemoryException with SQL Select

.net c# devart entity-framework-6 oracle


I'm now investigating an OutOfMemoryException that came up during a SQL query in our application.

x86.NET programme version 4.6.1 (There is no way to utilise it as x64.)
Devart.Data version 5.1491.0
Oracle, Devart.Data.Oracle Entity Framework
Oracle 12c.

What transpires?
This error is thrown by a particular query that accesses several tables with a lot of data. This only occurs after using the programme for a time; initially, it functions as intended. This query always fails once the error occurs; nevertheless, other queries succeed.

The reason for the exception is:
A "System.OutOfMemoryException"-type exception was raised. Layer Trace:

at Devart.Data.Oracle.OracleDataReader.a() 
at Devart.Data.Oracle.OracleDataReader.Read()

When executing

context.Database.SqlQuery<T>(query, allParameters.ToArray()).ToList()

is System.Data.Entity.DbContext the current context?
Is the SQL query (string) anything we created?
includes one parameter designating the maximum number of results to be rerun.

There isn't much of a difference between when the query executes successfully and when it doesn't while profiling the programme using dotMemory.
507MB total, of which 76MB are utilised by.NET
535MB is not working;.NET uses 104MB of that.
We are a long way from the 2GB that a.NET process may use.

The identical query is always successful when run with the "Oracle SQL Developer" in under 30 seconds.

DbMonitor shows a 25-second latency between the query and the rollback (done due to exception). There is a Error "Completed successfully" for both the query and the rollback.

Does anybody have an explanation for this problem, let alone a potential solution? Could DevArt unintentionally throw this exception, for example, by reaching a timeout? Is there an internal cache that is separate from the.NET process and eventually fills up?

I first asked this topic on the DevArt boards, but I never got a response.

Thanks for your assistance in advance.

3/13/2017 7:38:08 AM

Accepted Answer

Try adjusting the FetchSize property of your device as advised by here as your first choice.OracleCommand specifically to a fair value (like 100).

I had found this post before but I haven't been able to set the FetchSize (even after investigating for 2h now). We don't instantiate the OracleCommand ourselves; it is being done when executing the query.

To determine whether it is the reason, start with a rather low value and utilise the relationship string to indicate the value.

3/13/2017 11:14:21 AM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow