Memory Leak in Entity Framework? AccessViolationException

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
vonbrana
Posts: 8
Joined: Sun 04 Dec 2011 00:10

Memory Leak in Entity Framework? AccessViolationException

Post by vonbrana » Tue 14 May 2013 16:57

I am using dotConnect for Oracle version 6.70.293. I have a heavy traffic web service (.net WCF Soap Service) that experiences periodic crashes due to access violations coming from the Dev Art assembly. It happens about once every 10,000 database calls. The error message is:

Application: w3wp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
at Devart.Common.DbCommandBase.ExecuteDbDataReader(System.Data.CommandBehavior, Boolean)
at Devart.Data.Oracle.OracleCommand.ExecuteReader()
at MCPS.myMCPS.Data.DAL.ArticulationDataModule.GetRecommendations(MCPS.myMCPS.Data.DataContracts.Student)
at MCPS.myMCPS.Services.SilverLight.ArticulationDataService.GetRecommendations(MCPS.myMCPS.Data.DataContracts.Student)
at DynamicClass.SyncInvokeGetRecommendations(System.Object, System.Object[], System.Object[])
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(System.Object, System.Object[], System.Object[] ByRef)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(System.ServiceModel.Dispatcher.MessageRpc ByRef)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(System.ServiceModel.Dispatcher.MessageRpc ByRef)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(System.ServiceModel.Dispatcher.MessageRpc ByRef)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean)
at System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(System.ServiceModel.Channels.RequestContext, Boolean, System.ServiceModel.OperationContext)
at System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(System.ServiceModel.Channels.RequestContext, System.ServiceModel.OperationContext)
at System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(System.IAsyncResult)
at System.Runtime.Fx+AsyncThunk.UnhandledExceptionFrame(System.IAsyncResult)
at System.Runtime.AsyncResult.Complete(Boolean)
at System.Runtime.InputQueue`1+AsyncQueueReader[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Set(Item<System.__Canon>)
at System.Runtime.InputQueue`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].EnqueueAndDispatch(Item<System.__Canon>, Boolean)
at System.Runtime.InputQueue`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].EnqueueAndDispatch(System.__Canon, System.Action, Boolean)
at System.ServiceModel.Channels.SingletonChannelAcceptor`3[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Enqueue(System.__Canon, System.Action, Boolean)
at System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(System.ServiceModel.Channels.HttpRequestContext, System.Action)
at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(System.ServiceModel.Activation.HostedHttpRequestAsyncResult)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(System.Object)
at System.Runtime.IOThreadScheduler+ScheduledOverlapped.IOCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)
at System.Runtime.Fx+IOCompletionThunk.UnhandledExceptionFrame(UInt32, UInt32, System.Threading.NativeOverlapped*)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)

There seems to be now way to handle this exception so it always crashes the service.

I do not believe this was a problem last year in the application. This year I have added DevArt entity framework to the application. Could it be that I have a resouce leak in the way I use the DevArt EF. I instantiate every EF context in a using statement:

using (EFContext cntxt = new EFContext(ConnectionStringName))
{
}

Is there something more that I need to do to dispose of resources? Have you ever seen this problem?

Alec von Brand

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Memory Leak in Entity Framework? AccessViolationException

Post by Shalex » Mon 20 May 2013 13:44

Please refer to http://www.devart.com/dotconnect/oracle ... story.html: the bug with generating AccessViolationException when retrieving data via OracleDataReader using the x64 version of Oracle client is fixed starting from the 7.2.96 build (EF level uses plain ADO.NET level underneath including the OracleDataReader class).

Try using the latest (7.7.242) version of dotConnect for Oracle. If the issue persists, try to localize it and send us a small test project with the corresponding DDL/DML script.

If you do not have an access to the latest registered version of dotConnect for Oracle, try using the trial version to make sure that the problem is solved: http://www.devart.com/dotconnect/oracle/download.html.

Notify us about the results.

Post Reply