New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deadlock inside embedded database [CORE3209] #3583
Comments
Commented by: @dyemanov Why do you think it's a bug? It's a regular update conflict causing by two transactions updating the same record simultaneously. What is your transaction isolation mode? |
Commented by: Mark Kharitonov (mark.kharitonov) That is what I was afraid of - that we are doing something wrong. We are using NHibernate ORM for working with the database, so I am not sure what is the right answer. Can you tell me what should be our transaction isolation mode and I will check it? The regular mode of operation is that there are many concurrent writes and relatively rare reads. Thanks a lot. |
Commented by: @dyemanov I don't have any knowledge in NHibernate or the .NET provider, so you'd better ask this in the appropriate support lists (I'd start with firebird-net-provider at SourceForge). Commonly, you shouldn't be afraid of update conflicts but process them properly instead. If you have updates concurring for the same record and this is normal in your application (is it some aggregated table?) then you should serialize those updates (e.g. with explicit read locking), or handle update conflicts and re-attempt the operation (re-run the update statement for read-committed isolation mode, restart the transaction for snapshot isolation mode). |
Modified by: @pcisarstatus: Resolved [ 5 ] => Closed [ 6 ] |
Commented by: Mark Kharitonov (mark.kharitonov) We do write concurrently, but never to the same record. Is it possible to have this kind of an error when two different records are being updated? Thanks. |
Commented by: @dyemanov No, it's impossible. You're surely updating the same record (maybe indirectly, inside triggers). Or selecting the same set of records using SELECT WITH LOCK. You may try turning the v2.5 tracing feature on and then analyze the log to find out the problematic statements. |
Commented by: Mark Kharitonov (mark.kharitonov) Thanks for the prompt reply. And how do I turn tracing on, pardon my ignorance? |
Commented by: Mark Kharitonov (mark.kharitonov) Hi. I am trying to validate the embedded database and here is what I get: c:\dev\Firebird-2.5.0.26124-0_Win32\bin>gfix -validate c:\Logs\AGENT.FB Something is wrong, obviously. Any hints? Thanks. |
Commented by: @dyemanov Copy fbembed.dll as fbclient.dll and make it available to gfix, or install a standalone FB server. |
Submitted by: Mark Kharitonov (mark.kharitonov)
Failed to send result to server 32W2K3SP2VM-DEV.
NHibernate.Exceptions.GenericADOException: could not update: [ExecutionEntry#113_27_32W2K3SP2VM-DEV][SQL: UPDATE Run SET ExecutionId = ?, Source = ?, Destination = ?, ProtocolId = ?, Duration = ?, SampleCount = ?, StartTime = ?, ServerHostName = ?, SamplesSentToServer = ?, SampleInterval = ?, Parameters = ? WHERE Id = ?] ---> FirebirdSql.Data.FirebirdClient.FbException: deadlock
update conflicts with concurrent update
concurrent transaction number is 454728 ---> FirebirdSql.Data.Common.IscException: deadlock
update conflicts with concurrent update
concurrent transaction number is 454728
at FirebirdSql.Data.Client.Native.FesDatabase.ParseStatusVector(IntPtr[] statusVector)
at FirebirdSql.Data.Client.Native.FesStatement.Execute()
at FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteCommand(CommandBehavior behavior, Boolean returnsSet)
at FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteCommand(CommandBehavior behavior)
at FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteNonQuery()
--- End of inner exception stack trace ---
at FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteNonQuery()
at NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery(IDbCommand cmd)
at NHibernate.AdoNet.NonBatchingBatcher.AddToBatch(IExpectation expectation)
at NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Object[] oldFields, Object rowId, Boolean[] includeProperty, Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql, ISessionImplementor session)
--- End of inner exception stack trace ---
at NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Object[] oldFields, Object rowId, Boolean[] includeProperty, Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql, ISessionImplementor session)
at NHibernate.Persister.Entity.AbstractEntityPersister.UpdateOrInsert(Object id, Object[] fields, Object[] oldFields, Object rowId, Boolean[] includeProperty, Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql, ISessionImplementor session)
at NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Int32[] dirtyFields, Boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, Object obj, Object rowId, ISessionImplementor session)
at NHibernate.Action.EntityUpdateAction.Execute()
at NHibernate.Engine.ActionQueue.Execute(IExecutable executable)
at NHibernate.Engine.ActionQueue.ExecuteActions(IList list)
at NHibernate.Engine.ActionQueue.ExecuteActions()
at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session)
at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)
at NHibernate.Impl.SessionImpl.Flush()
at NHibernate.Transaction.AdoTransaction.Commit()
at Shunra.Infra.DAL.NHibernate.Transaction.Commit()
at NetworkCatcher.Entities.Agent.Server.DBHelper.DoUpdate(IPersistentObject obj)
at NetworkCatcher.Entities.Agent.Server.DBHelper.Update(IPersistentObject obj)
at NetworkCatcher.Entities.Agent.Server.ExecutionManager.ExecutionEntry.OnResultsSent(Int32 resultsCount)
at NetworkCatcher.Entities.Agent.Server.ExecutionManager.OnResultsSentToServer(ProtocolSampleBulk results)
at NetworkCatcher.Entities.Agent.Server.RunResultManager.SendToServer(ProtocolSampleBulk results)
The text was updated successfully, but these errors were encountered: