FirebirdSql.Data.FirebirdClient.FbException: too many open handles to database

entity-framework entity-framework-6 firebird

Question

I imported more data into a Firebird 2.5.6 database today, and I received the following exception:

System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> FirebirdSql.Data.FirebirdClient.FbException: too many open handles to database ---> FirebirdSql.Data.Common.IscException: too many open handles to database
   bei FirebirdSql.Data.Client.Managed.Version10.GdsDatabase.ProcessResponse(IResponse response) in C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\Client\Managed\Version10\GdsDatabase.cs:Zeile 641.
   bei FirebirdSql.Data.Client.Managed.Version10.GdsDatabase.ReadResponse() in C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\Client\Managed\Version10\GdsDatabase.cs:Zeile 673.
   bei FirebirdSql.Data.Client.Managed.Version10.GdsDatabase.ReadGenericResponse() in C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\Client\Managed\Version10\GdsDatabase.cs:Zeile 681.
   bei FirebirdSql.Data.Client.Managed.Version11.GdsStatement.Prepare(String commandText) in C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\Client\Managed\Version11\GdsStatement.cs:Zeile 80.
   bei FirebirdSql.Data.FirebirdClient.FbCommand.Prepare(Boolean returnsSet) in C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbCommand.cs:Zeile 1169.
   bei FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteCommand(CommandBehavior behavior, Boolean returnsSet) in C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbCommand.cs:Zeile 1190.
   bei FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteReader(CommandBehavior behavior) in C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbCommand.cs:Zeile 527.
   --- Ende der internen Ausnahmestapelüberwachung ---
   bei FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteReader(CommandBehavior behavior) in C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbCommand.cs:Zeile 533.
   bei FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteDbDataReader(CommandBehavior behavior) in C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbCommand.cs:Zeile 639.
   bei System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
   bei System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<Reader>b__c(DbCommand t, DbCommandInterceptionContext`1 c)
   bei System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
   bei System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
   bei System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
   bei System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
   bei System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
   --- Ende der internen Ausnahmestapelüberwachung ---
   bei System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
   bei System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
   bei System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__6()
   bei System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
   bei System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()
   bei System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult](Func`1 operation)
   bei System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
   bei System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
   bei System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
   bei System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   bei System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__1[TResult](IEnumerable`1 sequence)
   bei System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot)
   bei System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[TResult](Expression expression)
   bei System.Data.Entity.Internal.Linq.DbQueryProvider.Execute[TResult](Expression expression)
   bei System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source)

Can someone please clarify this?too many open handles to database means? This is something I've never seen before, and just displays 1 old entry..

1
3
8/25/2016 2:38:33 PM

Accepted Answer

The mistakeisc_too_many_handles OR The message "Error 335544761" signifies that you have used too many handles.

server.cpp (search for) is the Firebird 3 code that may be seen.isc_too_many_handles If Firebird cannot allocate a handle for a statement, transaction, blob, or "request" because there are already 65000 (MAX_OBJCT_HANDLES ) allocated and active handles on a single connection. Take note that this number refers to the connection's whole collection of handles (not per type).

If you engage in the following activities excessively:

  • without discarding (closing) any statement handles you no longer need, build new statement handles
  • begin a transaction but never commit it or turn it back (which deallocates the handle),
  • open blobs without shutting them (or opening several blobs simultaneously),
  • start making'requests' without dealing with the locations.

    I'm unsure of how and when these "requests" are utilized, so I can't really comment on them, but AFAIK they are used for embedded SQL support and certain internal Firebird components. Although it is unlikely that they are the root causes, they may be the last drop if there are already a lot of statements, blobs, and transactions.

Although you seem to be utilizing Entity Framework, it's also possible that the Firebird.net entity framework support or ADO.net driver is performing incorrectly. You may want to check your code for resource leaks. If you can consistently recreate it and you are certain that you are shutting resources on time, you could wish to record a bug on http://tracker.firebirdsql.org/browse/DNET (with all required code + database to reproduce).

4
8/26/2016 2:56:48 PM


Related Questions





Related

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