AccessViolation exception at OciDynamicType.nativeOCILobWrite

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
nicoleta.scrimint
Posts: 2
Joined: Tue 19 Feb 2019 07:43

AccessViolation exception at OciDynamicType.nativeOCILobWrite

Post by nicoleta.scrimint » Wed 14 Oct 2020 09:52

Hi,

I am using Devart dotConnect for Oracle version 9.11.980 with Entity Framework 6.4.4 version in .Net Framework 4.7.2. The connection is done to an Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production, from a machine where we have Oracle Client version 12.2.0.1.0, where both 32 bit and 64 bit are installed. In Environment variable Path, 32 bit path is before the 64bit path.

Sometimes the following error is encountered when saving a record which has a column with XMLTYPE type:

System.AccessViolationException
at OciDynamicType.nativeOCILobWrite(System.Runtime.InteropServices.HandleRef, System.Runtime.InteropServices.HandleRef, IntPtr, Int32 ByRef, Int32, Byte[], Int32, Byte, Int32, Int32, Int16, Byte)
at OciDynamicType.OCILobWrite(System.Runtime.InteropServices.HandleRef, System.Runtime.InteropServices.HandleRef, IntPtr, Int32 ByRef, Int32, Byte[], Int32, Byte, Int32, Int32, Int16, Byte)
at Devart.Data.Oracle.ch.a(Int32, Byte[], Int32, Int32)
at Devart.Data.Oracle.bu.a(Int32, Byte[], Int32, Int32)
at Devart.Data.Oracle.t.a(System.String)
at Devart.Data.Oracle.t..ctor(System.String, Devart.Data.Oracle.dm)
at Devart.Data.Oracle.bv.a(Devart.Data.Oracle.b0, System.String)
at Devart.Data.Oracle.OracleXml.b()
at Devart.Data.Oracle.OracleParameter.a(Devart.Data.Oracle.OracleDbType, System.Object, System.Object, Byte[], System.Collections.Hashtable, Int32, Int32, Int32, Int32, Int32, Boolean, Devart.Data.Oracle.OracleConnection, System.Data.ParameterDirection, Devart.Data.Oracle.OracleType, Devart.Data.Oracle.b0, Boolean ByRef)
at Devart.Data.Oracle.OracleParameter.a(Devart.Data.Oracle.b4 ByRef, Boolean, Devart.Data.Oracle.OracleConnection, Byte[], System.Collections.Hashtable, Devart.Data.Oracle.b0, Boolean ByRef, Int32) at Devart.Data.Oracle.OracleCommand.a(Devart.Data.Oracle.cr, Int32, Devart.Data.Oracle.OracleParameterCollection, Devart.Data.Oracle.b0, Boolean ByRef) at Devart.Data.Oracle.OracleCommand.InternalExecute(System.Data.CommandBehavior, System.IDisposable, Int32, Int32, Boolean)
at Devart.Common.DbCommandBase.ExecuteDbDataReader(System.Data.CommandBehavior, Boolean)
at Devart.Data.Oracle.OracleCommand.ExecuteNonQuery()
at Devart.Data.Oracle.Entity.ag.h()
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher+<>c.<NonQuery>b__4_0(System.Data.Common.DbCommand, System.Data.Entity.Infrastructure.Interception.DbCommandInterceptionContext`1<Int32>)
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Dispatch[[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.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.__Canon, System.Func`3<System.__Canon,System.__Canon,Int32>, System.__Canon, System.Action`3<System.__Canon,System.__Canon,System.__Canon>, System.Action`3<System.__Canon,System.__Canon,System.__Canon>)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.NonQuery(System.Data.Common.DbCommand, System.Data.Entity.Infrastructure.Interception.DbCommandInterceptionContext)
at System.Data.Entity.Internal.InterceptableDbCommand.ExecuteNonQuery()
at System.Data.Entity.Core.Mapping.Update.Internal.DynamicUpdateCommand.Execute(System.Collections.Generic.Dictionary`2<Int32,System.Object>, System.Collections.Generic.List`1<System.Collections.Generic.KeyValuePair`2<System.Data.Entity.Core.Mapping.Update.Internal.PropagatorResult,System.Object>>)
at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()
at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter+<>c.<Update>b__21_0(System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator)
at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](Int32, System.Func`2<System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator,Int32>)
at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update()
at System.Data.Entity.Core.Objects.ObjectContext.<SaveChangesToStore>b__153_0()
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Func`1<Int32>, System.Data.Entity.Infrastructure.IDbExecutionStrategy, Boolean, Boolean)
at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(System.Data.Entity.Core.Objects.SaveOptions, System.Data.Entity.Infrastructure.IDbExecutionStrategy, Boolean)
at System.Data.Entity.Core.Objects.ObjectContext+<>c__DisplayClass148_0.<SaveChangesInternal>b__0()
at System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Func`1<Int32>)
at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(System.Data.Entity.Core.Objects.SaveOptions, Boolean)
at System.Data.Entity.Core.Objects.ObjectContext.SaveChanges(System.Data.Entity.Core.Objects.SaveOptions)
at System.Data.Entity.Internal.InternalContext.SaveChanges()
at System.Data.Entity.Internal.LazyInternalContext.SaveChanges()
at System.Data.Entity.DbContext.SaveChanges() .

This exception happens in a windows service, where we consume messages from a service bus and where the Entity Framework DbContext lifetime is scoped to the message consumer lifetime. Sometimes, this exception happens when there is a continuous load activity on the database, sometimes when there is a single activity on the database.

Can you please give me directions in finding the cause of this exception?

Thank you!

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

Re: AccessViolation exception at OciDynamicType.nativeOCILobWrite

Post by Shalex » Fri 16 Oct 2020 17:23

We will investigate the issue and notify you about the result.

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

Re: AccessViolation exception at OciDynamicType.nativeOCILobWrite

Post by Shalex » Mon 05 Apr 2021 16:16

The bug with throwing AccessViolationException by OracleCommand.ExecuteScalar() in the OCI mode is fixed in dotConnect for Oracle v9.14.1228: https://forums.devart.com/viewtopic.php?f=1&t=44776.

If this fix doesn't help with the issue you have encountered, please localize the problem in a small test project and send it to us with the corresponding DDL/DML script.

Post Reply